i've been searching all over and can't get any solution to work... this is my code, the problematic area is how to create 1 large array of per-sql-row array: (the commented-out line is the one causing the error).
$result = mysqli_query($con, "SELECT * FROM `Orders` WHERE `userID` = " . $objData->userid . " ORDER BY `recievedDate` DESC LIMIT 10");
$resArray = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_row())
{
$tempArr = array("orderid" => $row[0], "orderdate" => $row[2], "orderstatus" => $row[4]);
//$resArray = array_push((array)$resArray, (array)$tempArr); <== problematic line commented out
}
echo json_encode($resArray);
} else {
echo "";
}
thanks!
mysqli
you should be using parameterized queries andbind_param
to add user data to your query. Never use string interpolation to accomplish this. A simple mistake can have disastrous consequences. – tadman Nov 15 '13 at 15:54