MySQL Forums
Forum List  »  PHP

Re: Migrating MySQL site to Oracle Linux and new PHP
Posted by: Peter Brawley
Date: April 22, 2019 08:51AM

> PHP Warning: mysqli_fetch_assoc() expects parameter 1 to be
> mysqli_result, null given in /var/www/html.branchcache/index.php on line 11

Which tells you the query errored out. In your mysqli_query() call you forgot to pass the connection param. All MySQL calls can throw errors so they need error handling, eg ...

$conn = mysqli_connect(...) or exit( mysqli_connect_error() );
...
$res = mysqli_query( $conn, $qry ) or exit( mysqli_error($conn) );

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

Options: ReplyQuote


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


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.