What am i missing in this MySQL statement?
Posted: Wed Nov 09, 2005 11:25 am
Hi again!!!
I had to change routes on my previous questions and i almost have it working except.... My INSERT statement will not work for the archiving table
All rows match up except i did not include the auto increment of course.. but I still get the error...
OUT PUT
I had to change routes on my previous questions and i almost have it working except.... My INSERT statement will not work for the archiving table
All rows match up except i did not include the auto increment of course.. but I still get the error...
here is the code... What am i doing wrong???You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Code: Select all
if(!empty($num_rows_rp)){
//fetch all the DB IDs in an array to reduce tons of DB query...
$idrs = mysql_query("SELECT productid FROM CB_rateplan;") or die(mysql_error());
while($row = mysql_fetch_row($idrs)){
$DB_IDList[] = $row[0];
$Update_Query = "UPDATE CB_rateplan SET <1> WHERE productid=<2>";
}
//match and update/add as needed... trifle now
foreach($XML_IDList as $p_id) {
//print "p_id; ".$p_id. "<BR>";
$all_rows = mysql_query('SELECT * FROM CB_rateplan WHERE productid = '.$p_id.';');// get rows from production table
$archive = "INSERT INTO archive_rateplan VALUES $f_move ;";//insert matching rows into archive table
$delete = 'DELETE FROM CB_rateplan WHERE productid = '.$p_id.';';//Delete all matching products after they have been archived
$move = array();
if(in_array($p_id, $DB_IDList)) {
$db_row = mysql_fetch_row($all_rows);
$move[] = "'".implode("', '", $db_row)."'";
$f_move = "(".implode(", ", $move). ")<br>";
print $f_move;
mysql_query($archive) or die(mysql_error());
//mysql_query($delete);//commented out until Archive works
//mysql_query($add_rp);//commented out until Archive works
}
}
}else { // Else to First If
mysql_query($add_rp);
echo $add_rp;
}//FIRST IFconnected
('1', 'Greater Freedom 700 - 2YR', '700', '39.9900', '0.4000', '20.0000', '0.9900', 'up to $.99/min', '24', '$200.00', '', '', '1000', '', '1000', '', '0', '$0.00/min within home calling area ($0.25/min outside home calling area)', '', '', '', '', '53037', 'alltel wireless', 'images/carriers/', 'alltel_logo.gif', 'false', '13283')
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1