View Single Post
Old 11-04-2008, 01:21 PM   #1 (permalink)
code_junkie
The Contributor
 
Join Date: Sep 2008
Posts: 39
Thanks: 9
code_junkie is on a distinguished road
Default Loading data form table to table?

I am having a problem with the last bit of my code. I am trying to make a script that will load data from one table and insert it into another table in the same DB. This is what I got.
PHP Code:
$query "INSERT INTO call_in SELECT time, date, company_id, vehicle_id, stop_no, driver_id, cargo_11, cargo_15, cargo_16, cargo_other FROM online_report VALUE time, date, company_id, vehicle_id, stop_no, driver_id, cargo_11, cargo_15, cargo_16, cargo_other";
  
$result = @mysql_query ($query);  //runs the query
  
  
if (mysql_affected_rows() == 1) {  //if it ran ok.
    
    
echo '<p>The database was updated</p>';
    exit();
        
    } else {  
// if did not run ok.
      
$message '<p>The database was not updated</p>';
    } 
Can anyone give me some guidance with this issue?
__________________
Trying to learn all I can about PHP. Teach me what you know...
code_junkie is offline  
Reply With Quote