I am not sure this is a bug or not but at times when I retrieving a result using mysql, I get this:
$result->fetch_array();
mysqli_result Object (
[current_field] => 0
[field_count] => 1
[lengths] => Array (
[0] => 3
)
[num_rows] => 1
[type] => 0
) Fatal error: Cannot use object of type mysqli_result as array
And looking at the documentation, it should either return an array or null, not an object. Is this a bug?
A look at that code when condensed looks like this:
$query="SELECT * FROM table where id=''";
$result=$link->query($query);
$row=$result->fetch_array();
print_r($row);
The sample code does not reproduce the issue (which all sample code should do) in PHP 5.3.4.
$resultis of type mysqli_result. Based on that and the dumped values, you’re using$resultwhere you should be using$row.