I have been at this one issue for days, and I have searched and found many similar issues without any one practical solution that solves mine. I am currently migrating a site from PHP 5 to PHP 7 where the old site was using MySQL_Query() to MySQLi_Query(). The old site works just fine but since I'm setting up a new LAMP server I now have to port it to use the newer code instead of the obsolete tags as indicated above. From what I can see my code is clean. Let me frame the issue. I am receiving a PHP error when connect using the new MySQLi query which says: Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /var/www/XXXXXX/test.php on line XX Here is my table information as seen in PHPMyAdmin Database Table Name: return (InnoDB)(latin1_swedish_ci) Field name Type Allow nulls? Key Default value Extras nReturnID int(11) No Primary NULL Auto_increment nInfoID int(11) Yes None NULL nMemberID int(10) Yes None NULL nLocationID int(11) Yes None NULL dDate varchar(255) Yes None NULL sReturnStatus varchar(255) Yes None NULL sReturnMaterial varchar(255) Yes None NULL nReturnMaterialNum tinyint(4) Yes None NULL sReturnNotes blob Yes None NULL nSerial varchar(255) Yes None NULL Here is the code: (Some code not affecting the outcome has been removed for security purposes) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //removed content here $sLink = new MySQLi(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE); if (MySQLi_Connect_Errno($sLink)) { printf("Common :: Could not connect to MySQL database: %s\n", MySQLi_Connect_Error($sLink)); exit(); } else { if ($sRflag == "Yes") { print("Database connection established. <br />\n"); print("-----------------------------------------------------------------------<br />"); } } // removed content here // resume content $sQuerySelect = "SELECT * FROM return WHERE nMemberID='$nMemberID' AND nInfoID='$nInfoID' ORDER BY nReturnID DESC"; $sQueryExecute = MySQLi_Query($sLink, $sQuerySelect); if (MySQLi_Num_Rows($sQueryExecute) > 0) { while($nRow=MySQLi_Fetch_Assoc($sQueryExecute)) { $sReturnStatus = $nRow['sReturnStatus']; } } print($sReturnStatus); ************************************************************************** So of course the above code give me the following output on the page. Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /var/www/XXXXXX/test.php on line XX (corresponds with the line --> if (MySQLi_Num_Rows($sQueryExecute) > 0){ ) and when I add the "or die(mysqli_error($sLink))" function to trap the error I get the following: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'return WHERE nMemberID='1' AND nInfoID='1' ORDER BY nReturnID DESC' at line 1 So with that said I have looked through the SQL and everything is correct that I can see. Here is that SQL again: "SELECT * FROM return WHERE nMemberID='$nMemberID' AND nInfoID='$nInfoID' ORDER BY nReturnID DESC"; Does anyone know why I am getting this? What should I change? An example is appreciated as I have tried everything I know. It doesn't matter if the table is empty or if it has data in it I get the same error. I will say that I am using the exact same query (except table names etc.) to connect to all of the other tables and am not getting any errors like this and am returning data as expected. Please save my brain from exploding. thanks for your help, RK