how form array in do-while?
I try to form array in the do-while:
$result = mysql_query("SELECT * FROM data WHERE company='$companyID'", $db);
if (mysql_num_rows($result) > 0)
{
$resultData = mysql_fetch_array($result);
do
{
$json[] = array('product' => $resultData['product'],
'title' => $resultData['title']);
}
while($resultData = mysql_fetch_array($result));
echo json_encode($json);
}
In exit all datais empty(error):
"[{"product":"","title":""},{"product":"","title":""},{"product":"","title":""},{"product":"","title":""}]"
No comments:
Post a Comment