I was wondering if somebody could help me. this is driving me crazy.
I am trying to send an array from a mysql_fetch_ass oc result from table total_orders to table orders_complete . I have the following code:
[php]
<?php include("config .php");$sql = "SELECT item, cost FROM orders_total";$ result = mysql_query($sq l) or die(mysql_error ()); while($row = mysql_fetch_ass oc($result)) { $newValue = $row['item'] . $row['cost'].", "; $sql = "UPDATE orders_complete SET ord_descr='$new Value ' WHERE date='xx/xx/xx' and time='xx:xx:xx' "; if(!mysql_query ($sql)) { user_error("Fai led to update row: $newValue", E_USER_NOTICE); }}?>
[/php]
The above code sucessfully updates the row with time=xx:xx:Xx and date=xx/xx/xx but...
When i search the orders_complete table for the new updated row. It only seems to enter into the table the last key of the array and not the FULL array
i.e.
total_orders table echos
12" pizza £12
half lb burger £3.40
side portion of chips
would enter into the database ONLY side portion of chips
if i put a exit(); inbetween the 2 end }} shown at the end of the script
when I do a seach for the row it only shows as entered
12" pizza £12
and nothing else.
I was wondering if somebody could help me in what im doing wrong. it looks like that the while loop when cycled is overwriting each entry hence I can only see 1 value of the array rather than the total array seporated with a ,
I am trying to send an array from a mysql_fetch_ass oc result from table total_orders to table orders_complete . I have the following code:
[php]
<?php include("config .php");$sql = "SELECT item, cost FROM orders_total";$ result = mysql_query($sq l) or die(mysql_error ()); while($row = mysql_fetch_ass oc($result)) { $newValue = $row['item'] . $row['cost'].", "; $sql = "UPDATE orders_complete SET ord_descr='$new Value ' WHERE date='xx/xx/xx' and time='xx:xx:xx' "; if(!mysql_query ($sql)) { user_error("Fai led to update row: $newValue", E_USER_NOTICE); }}?>
[/php]
The above code sucessfully updates the row with time=xx:xx:Xx and date=xx/xx/xx but...
When i search the orders_complete table for the new updated row. It only seems to enter into the table the last key of the array and not the FULL array
i.e.
total_orders table echos
12" pizza £12
half lb burger £3.40
side portion of chips
would enter into the database ONLY side portion of chips
if i put a exit(); inbetween the 2 end }} shown at the end of the script
when I do a seach for the row it only shows as entered
12" pizza £12
and nothing else.
I was wondering if somebody could help me in what im doing wrong. it looks like that the while loop when cycled is overwriting each entry hence I can only see 1 value of the array rather than the total array seporated with a ,
Comment