Jump to content


Photo

Any idea why this bit of code is failing? (query)


  • Please log in to reply
3 replies to this topic

#1 Prismatic

Prismatic
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 17 May 2006 - 06:37 AM

$queryStr = "SLEECT * FROM users WHERE username = '". $this->username ."'";
$queryRes = mysql_query($queryStr);
$queryNum = mysql_num_rows($queryRes);

Replacing the $queryStr line with this:
$queryStr = "SLEECT * FROM users WHERE username = 'prismatic'";
it errors as well, which leads me to believe it's a syntax issue somewhere I cant spot :(

The error is:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in class.php on line 149

Is it a format issue? I cant seem to be able to spot the error :(

#2 samshel

samshel
  • Members
  • PipPipPip
  • Advanced Member
  • 837 posts

Posted 17 May 2006 - 06:58 AM

try some error handling like


$queryRes = mysql_query($queryStr) or die (mysql_error());

and it will show u the exact problem....

hth
Cheers,
SamShel
-----------------------------------------------
--: FUTURE IS LINUX :--
-----------------------------------------------

#3 haydndup

haydndup
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts
  • LocationJohannesburg, South Africa

Posted 17 May 2006 - 07:22 AM

Well, for starters, you've spelt SELECT wrong

$queryStr = "SLEECT * FROM users WHERE username = 'prismatic'";
should be:
$queryStr = "SELECT * FROM users WHERE username = 'prismatic'";

[!--coloro:#660000--][span style="color:#660000"][!--/coloro--]The Gene Pool Could Use A Little Chlorine[!--colorc--][/span][!--/colorc--]

#4 Prismatic

Prismatic
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 17 May 2006 - 07:46 AM

[!--quoteo(post=374588:date=May 17 2006, 02:22 AM:name=WhyWindows)--][div class=\'quotetop\']QUOTE(WhyWindows @ May 17 2006, 02:22 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Well, for starters, you've spelt SELECT wrong

$queryStr = "SLEECT * FROM users WHERE username = 'prismatic'";
should be:
$queryStr = "SELECT * FROM users WHERE username = 'prismatic'";
[/quote]

rofl, I knew it would be something as simple as that! Thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users