All,
I am having difficulty with a MySQL query in PHP. I am getting the following error when executed: Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp2\htdocs\htdocs\Speedtest\executimpcsv.php on line 22
Full Code:
<?php session_start();error_reporting(E_ALL); ini_set( 'display_errors','1');if(isset($_GET['compname'])) { $compname = $_GET['compname']; } else { echo Error; } $_SESSION['compname']= $compname;echo "<br>";echo $compname;
$dbConnection = mysqli_connect('****', '****', '****', 'speedtest');
$query = "SELECT 'ExpectedRig' FROM 'rigcomputers' WHERE 'ComputerName' = '$compname'";$result = mysqli_query($dbConnection, $query);
if (mysqli_num_rows($result) > 0) {
echo "<ul>";
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
echo "<li>{$row['ExpectedRig']}";
}
echo "</ul>";
} else {
echo "Query didn't return any result";
}
echo "<br>";echo($_SESSION['compname']);
?>
I would like to store the result of the query in a Session variable to carry to another page. However, I can't get this query to give me a result. I have confirmed that the table has an entry that matches the variable for $ComputerName.
I have tried various methods of writing this query, but it appears I am stuck. Thank you in advance for your help.