Page 1 of 1
[solved]
Posted: Tue Apr 11, 2006 11:13 am
by gaogier
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/gaogier/public_html/sreport.php on line 15
The Special Reports guide requested cannot be found
i dont know what that error means, if you can explain it, ill be greatful
Posted: Tue Apr 11, 2006 11:25 am
by JayBird
show your code
Posted: Tue Apr 11, 2006 12:32 pm
by gaogier
the code has been cut down to what i think is the error
Code: Select all
function spview($id) {
require_once ('../mysql_connect.php');//connect to db
/* query for item */
$query = "SELECT * FROM sp WHERE id=$id";
$result = mysql_query ($query);
/* if we get no results back, error out */
$numrtn = mysql_num_rows($result); /*line of error */
if ($numrtn == 0) {
echo "The Special Reports guide requested cannot be found\n";
echo $id;
return;
}
Posted: Tue Apr 11, 2006 12:36 pm
by Red Blaze
gaogier wrote:the code has been cut down to what i think is the error
Code: Select all
function spview($id) {
require_once ('../mysql_connect.php');//connect to db
/* query for item */
$query = "SELECT * FROM sp WHERE id=$id";
$result = mysql_query ($query);
/* if we get no results back, error out */
$numrtn = mysql_num_rows($result); /*line of error */
if ($numrtn == 0) {
echo "The Special Reports guide requested cannot be found\n";
echo $id;
return;
}
You may want to try:
Code: Select all
$query = 'SELECT * FROM sp WHERE id = "'. $id .'"';
Unless $id is empty, then you need to give $id a correct value. That's what I think.
Posted: Tue Apr 11, 2006 1:40 pm
by John Cartwright
$result = mysql_query ($query) or die(mysql_error());
Always include error reporting, as it will give you useful information as to why your error occured
Posted: Tue Apr 11, 2006 2:03 pm
by gaogier
solved, thanks
Posted: Tue Apr 11, 2006 2:23 pm
by JayBird
Thanks for posting your solution to help others

Posted: Tue Apr 11, 2006 2:43 pm
by John Cartwright
gaogier wrote:solved, thanks
Also please don't erase the topic of this thread -- just prefix it with [solved], others may find this thread useful aswell..
Posted: Tue Apr 11, 2006 5:36 pm
by gaogier
it was just a typo
it was ment to be id, instead it was ud
it was deep in the code, so, my advise check you havnt done any typos, make sure all fields match