Forum Moderators: coopster
Here is my code:
$fp = fopen ('sessions/xxw.dat', "r");
while ($data = fgetcsv ($fp, 500)) {
//setup values from array
$item_id = $data[0]; // test for this one below to ensure we don't bring in blank rows
$item_desc = $data[1];
$item_price = $data[2];
$item_qty = $data[3];
$item_postage = $data[4];
if ($item_id) {
mysql_query("INSERT INTO phpcart_items_ordered (order_id,item_id,item_desc,item_price,item_qty,item_postage) VALUES
('$order_id','$item_id','$item_desc','$item_price','$item_qty','$item_postage')");
echo "$order_id $item_id $item_desc $item_price $item_qty $item_postage";
echo "<br />";
}
}
fclose ($fp);
I have been looking at this problem for a couple of days now and my eyes have turned monitor shaped. I must have missed something somewhere.
Note - $order_id is set up earlier in the program
Can anyone help?
Thanks in advance
nn :)
Besides I'm not sure if it's ok to include numerical values in single quotes, but if it's ok for the first row ...
What I'd try is this: echo the complete insert query, copy and paste it to mysql sql-form and see what happens.
Sometimes it just doesn't go my way....
Thanks for your input - I suspected something simple.
nn :)