Current location: Hot Scripts Forums » Programming Languages » PHP » HTML table cell data insert into database


HTML table cell data insert into database

Reply
  #1 (permalink)  
Old 05-25-09, 10:25 PM
conmen80 conmen80 is offline
Newbie Coder
 
Join Date: May 2009
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
HTML table cell data insert into database

Hi all, I need help in php program.

Below is a html table which load all related data records selected by SQL query from table_A (assume it was a temporary table), I want those related temporary data to insert into another table, which named table_B in the database, after the insertion to table_B, all related data from table_A will delete, how can I accomplish it?

Lets say below html table has success load 20 records from table_A, after the authenticated of all data is correct, will submit and insert into table_B, those 20 records will remove from table_A once successful added to table_B.

PHP Code:

while($row mysql_fetch_array($result)){
    
$data1 $row['data1'];
    
$data2 $row['data2'];
    
$data3 $row["data3"];
    
$data4 $row["data4"];
    
$data5 date('d M Y'strtotime($row["data5"]));
                            
$str "<tr>                                        
            <td class='list'><div style='margin:0 5px 0 5px;'>
$data1</div></td>
        <td class='list'><div style='margin:0 5px 0 5px;'>
$data2</div></td>
        <td class='list'><div style='margin:0 5px 0 5px;'>
$data3</div></td>                
        <td class='list'><div style='margin:0 5px 0 5px;'>
$data4</div></td>
        <td align='center' class='list'>
$data5</td>
        </tr>"
;
                        
echo 
$str

It is too long to get stuck on this part on my program, hope can find a best solution right here and the program can get through for further develop.

Thanks!!

Last edited by conmen80; 05-25-09 at 10:36 PM.
Reply With Quote
  #2 (permalink)  
Old 05-26-09, 02:52 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Why not just run a simple truncate/delete query on table_a after the data is added into table_b?

PHP Code:

$del "TRUNCATE TABLE table_a"
Reply With Quote
  #3 (permalink)  
Old 05-26-09, 09:40 PM
conmen80 conmen80 is offline
Newbie Coder
 
Join Date: May 2009
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
This is what i thought, thanks mdhall.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting data to mysql table using php Tjobbe PHP 4 09-28-06 06:37 AM
Classified Ads skipper23 Perl 3 11-22-05 02:22 AM
Newbie MySQL fccolon PHP 2 03-16-04 10:54 AM
Classified Ads skipper23 Perl 2 12-30-03 03:43 AM
help plz: format retrieved Mysql data in HTML with PHP paulj000 PHP 2 10-19-03 08:03 PM


All times are GMT -5. The time now is 08:36 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.