0

When executing the code below, I am getting the error: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given. From my understanding this would imply that mysql_query is returning false meaning the query is failing but I am not sure why.. Any ideas?

<?php
include 'global.php';

$case=$_GET['case'];

$query=" SELECT * FROM cases WHERE case='$case'";
$result=mysql_query($query);
$num=mysql_num_rows($result);
mysql_close();

$i=0;
while ($i < $num) {
$first=mysql_result($result,$i,"sm_firstname");
$last=mysql_result($result,$i,"sm_lastname");
?>
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by nasablast
1

case is a keyword in mysql. place all table and field names within backticks, like:

SELECT * FROM `cases` WHERE `case` = '$case'

The backtick button is usually before the number 1 on your keyboard (depends on the type). My keyboard needs the ALT + backtick button, release ALT, then any other key to display it.

0

Thanks, the error is gone.

Edited by nasablast: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.