replacing @mysql_fetch_array for php7 upgrade

Viewed 14518

I'm trying to migrate a Wordpress site. My new host uses PHP7, and there's a plugin that calls @mysql_fetch_array which is a function that has been removed from PHP7.

This is the function call within its control loop:

while( $row = @mysql_fetch_array( $result) ) {
    $newSlider = array();
    $newSlider['name'] = $row['title'];
    $newSlider['value'] = $row['alias'];
    $toReturn[] = $newSlider;
}

I did a print_r of the $result Object, and this was the result:

mysqli_result Object
(
    [current_field] => 0
    [field_count] => 2
    [lengths] => 
    [num_rows] => 2
    [type] => 0
)

Is there a drop-in replacement function for @mysql_fetch_array that works with PHP7?

1 Answers
Related