Welcome Guest, Not a member yet? Register   Sign In
mysql_num_rows() error please help!!
#1

[eluser]Ben Lester[/eluser]
Hello I received this error in this script. Can someone help me how to fix it.. Thanks in advance.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/blitzcit/public_html/viewrace.php on line 27
Invalid Usage



<?php
/*-----------------------------------------------------
-- Mono Country v1.0 BETA
-- A product of DBS-entertainment
-- Copyright held 2005 by Dabomstew
-- INDEX.php
-----------------------------------------------------*/
session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();
$race=abs((int) $_GET['race']);
$q=mysql_query("SELECT * FROM race_results WHERE rrID={$race}", $c);
if(mysql_num_rows($q)==0) { die("Invalid Usage"); }
$r=mysql_fetch_array($q);
print "<h3>Race Between {$r['rrCHALLENGER']} and {$r['rrCHALLENGED']}</h3><hr />
Challenger: {$r['rrCHALLENGER']} (Used: {$r['rrCHRCAR']})<br />
Challenged: {$r['rrCHALLENGED']} (Used: {$r['rrCHDCAR']})<br />
Type: {$r['rrTYPE']}<br />";
if($r['rrTYPE'] == "Betted") { print "Bet: \${$r['rrBET']}<br />"; }
print "Winner: {$r['rrWINNER']}<br />
Result: {$r['rrNOTES']}<br /><hr />
&gt; <a href='carcentral.php'>Goto Car Central</a><br />
&gt; <a href='garage.php'>Goto Your Garage</a>";

$h->endpage();
?&gt;
#2

[eluser]Dam1an[/eluser]
a) Use [ code ] blocks!
b) This isn't even CI bsed code
c) The error gives a pretty good description of what's cauing it, try doing a var dump on the query result
#3

[eluser]Thorpe Obazee[/eluser]
[quote author="Dam1an" date="1244559262"]a) Use [ code ] blocks!
b) This isn't even CI bsed code
c) The error gives a pretty good description of what's cauing it, try doing a var dump on the query result[/quote]

Same thing Fuzzy said here

Question probably belongs to a PHP forum or IRC.
#4

[eluser]Ben Lester[/eluser]
thanks for the response guys.. in what part should i change the [code]?

Thanks
#5

[eluser]Thorpe Obazee[/eluser]
[quote author="Ben Lester" date="1244559526"]thanks for the response guys.. in what part should i change the [code]?

Thanks[/quote]

ok definitely a bot.

Edit: saw the [ code ] block. put it around your code.
#6

[eluser]Dam1an[/eluser]
@bargainph, I don't even think he's listening to what we're saying
@Ben, I'm going to let you in on a secret here, [URL=http://www.lmgtfy.com/?q="Warning:+mysql_num_rows():+supplied+argument+is+not+a+valid+MySQL+result+resource"]lmgtfy[/URL] Wink




Theme © iAndrew 2016 - Forum software by © MyBB