Gah! I can't for the life of me figure out why this isn't working. From within a while statement, I'm trying to insert records into a db.
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$ins = "INSERT INTO temp (product_id, quantity, sessionid, price, shipping, description) VALUES ('".$row['product_id']."', '".$_SESSION['cart'][$row['product_id']]."', '".$sessnum."', '".$row['product_price']."', '".$row['shipping_cost']."', '".$row['product_desc']."')";
$res = mysql_query($ins);
....
}
If I echo $ins, I get a good query:
INSERT INTO temp (product_id, quantity, sessionid, price, shipping, description) VALUES ('1345', '1', 'gt4qe3cv1vpkz9akt9trnnlat7', '129', '9', 'TSHIRT - Blue/Green - SMALL')
In fact, if I copy and paste this query at the mysql prompt, it works fine. But it doesn't work when the script runs. Nothing is inserted into my table. I did:
if($res) {
echo 'fine';
}
And it printed 'fine' to the screen. I don't understand what's happening. I checked all of the syntax, etc., but it's not working. Help!