Below is the code:
$result=mysql_query("select * from choices where a_id='$taskid'")or die(mysql_error());
while($row=mysql_fetch_assoc($result))
{ print_r($row); }
Why did I only got []
? What's wrong?
More: It can not be empty. The more complete code is as follows:
$result=mysql_query("select * from choices where a_id='$taskid'")or die(mysql_error());
$resultset=array();
while($row=mysql_fetch_assoc($result))
{
$temp=shuffle(array_slice($row,3));
$row1=array_splice($row,3,7,$temp);
$resultset[]=$row1;
}
echo json_encode($resultset);
I want to shuffle the mysql query results from index 3 to index 7, only to find that the values from index 3 to index 7 are returned without being shuffled. Other values are undefined
in Javascript.
What's wrong?