An error with array_push function
Posted: Tue Dec 28, 2010 11:19 pm
Hello,
I am trying to push values into an array and I get this error:
Parse error: syntax error, unexpected T_DOUBLE_ARROW in...
My code is (I added the words ERROR HERE on the problem line):
Can someone please help me and tell me what am I doing wrong?
Thank you
I am trying to push values into an array and I get this error:
Parse error: syntax error, unexpected T_DOUBLE_ARROW in...
My code is (I added the words ERROR HERE on the problem line):
Code: Select all
function fGetOrders($day, $month, $year)
{
require("dbCon.php");
$orders = array();
$orderDets = array();
$i = 0;
$order = mysql_query("select * from customer_orders where day = $day and month = '$month' and year = $year") or die(mysql_error());
$numRows = mysql_num_rows($order);
if($numRows <> 0)
{
while($row = mysql_fetch_assoc($order))
{
$orders[$i]['name'] = $row['name'];
$orders[$i]['phone'] = $row['phone'];
$orders[$i]['time'] = $row['time'];
$orders[$i]['paid'] = $row['paid'];
$orders[$i]['comments'] = $row['comments'];
$order_id = $row['order_id'];
$orders[$i]['dets'] = array();
$dets = mysql_query("select * from customer_order where order_id = $order_id") or die(mysql_error());
while($row1 = mysql_fetch_assoc($dets))
{
$product = $row1['product'];
$qty = $row1['qty'];
array_push($orderDets,'product'=>$product,'qty'=>$qty);ERROR HERE
}
$i++;
}
}
return($orders);
}Thank you