Page 1 of 1
WTF is wrong with this?!
Posted: Sat Jan 22, 2005 1:06 pm
by Terencentanio
Code: Select all
$msgs = "SELECT * FROM rs2_msgs WHERE to = '$logged'";
$mresult = mysql_query($msgs);
$mnum = mysql_numrows($mresult);
Someone see an error? 'cos I can't.
Posted: Sat Jan 22, 2005 1:12 pm
by John Cartwright
Posted: Sat Jan 22, 2005 1:19 pm
by Terencentanio
And what's wrong with it?
Posted: Sat Jan 22, 2005 1:24 pm
by John Cartwright
change
to
from php.net
For downward compatibility mysql_numrows() can also be used. This is deprecated however.
Posted: Sat Jan 22, 2005 1:27 pm
by Terencentanio
That doesn't work either.
Posted: Sat Jan 22, 2005 1:36 pm
by John Cartwright
What exackly is being returned? Any output?
Are you sure your query is matching any rows?
Posted: Sat Jan 22, 2005 1:41 pm
by Terencentanio
Yep. The "to" is the same as the "logged" ... but it won't return owt.
Re: WTF is wrong with this?!
Posted: Sat Jan 22, 2005 1:50 pm
by HormonX
$mresult = mysql_query($msgs);
this is missing one variable and that would be a link indentifier.
$mresult = mysql_query($msgs , $link);
hopefully that helps.
Greg
Posted: Sat Jan 22, 2005 1:54 pm
by Terencentanio
And what's the link for?
I have used this code so many times, it just isn't working now.
If I remove the "WHERE --" from the SQL, it works fine... but that's no good.
Posted: Sat Jan 22, 2005 1:59 pm
by John Cartwright
A longshot but try
Code: Select all
$msgs = "SELECT * FROM `rs2_msgs` WHERE `to` = '".trim($logged)."'";
Posted: Sat Jan 22, 2005 2:20 pm
by Terencentanio
w00t. works

Thanks.
Posted: Sat Jan 22, 2005 10:35 pm
by mrmachoman
I fear you were having problems since "to" is a SQL reserved word. Be very careful when using reserved words in your DB.