MySQL Forums
Forum List  »  PHP

Migrating MySQL site to Oracle Linux and new PHP
Posted by: Jason Kinninger
Date: April 22, 2019 08:24AM

I originally had a site that read a MySQL database running on SUSE Linux running PHP 5.3 and MySQL 5.5. I am attempting to migrate the site to Oracle Linux 76. with PHP 7.2.16 with MySQL 8.0.15. I have all the data migrated to the new database I just can't get the webpage to show the table content.

My index.php looks like this -
<?php
include 'db/config.php';
include 'db/opendb.php';

$output = "";

// $sql = "select url from prime_cache_list where enabled = 1";
$sql = "select url from branch_cache.prime_cache_list where enabled = 1 order by dt_updated desc";
$res = mysqli_query($sql) or trigger_error(mysqli_error()." in ".$sql);

while($row = mysqli_fetch_assoc($res)) {
$output .= $row['url'] . "\n";
}

header("Content-Type:text/plain");
echo $output;
?>

When I try to access the site I am getting this error - PHP Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in /var/www/html.branchcache/index.php on line 11

I was reading where in version 8 I should use mysqli instead of the older mysql_ commands. Not sure why it is getting null data when I can see the data within the database. Should I use something other than mysqli_fetch_assoc to get my data?

Options: ReplyQuote


Subject
Written By
Posted
Migrating MySQL site to Oracle Linux and new PHP
April 22, 2019 08:24AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.