$query = "select * from tblRecords where record_category = '" . $cat . "' order by record_artist";
$result = $link->query($query);
This is the query that I use, to fetch the results, this works ok.
while($record = $result->fetch_array()) {
array_push($arr_result, $record);
}
And this is the code I add each value to the array. But after
echo json_encode($arr_result);
This is the result set I receive:
https://i.stack.imgur.com/Gmggl.png
What am I doing wrong?
There is no function like
fetch_array()in PHP, I think you’re using a predefined MySQL class which internally callsmysql_fetch_array(), so check the class, actually you are getting correct result but by usingMYSQL_BOTH(default), you’ll get an array with both associative and number indices.Use
Or
You must have forgotten to write a argument with
fetch_array().reference