PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Terencentanio
Forum Commoner
Posts: 27 Joined: Mon Dec 06, 2004 10:32 am
Location: England
Post
by Terencentanio » Sat Jan 22, 2005 1:06 pm
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.
Terencentanio
Forum Commoner
Posts: 27 Joined: Mon Dec 06, 2004 10:32 am
Location: England
Post
by Terencentanio » Sat Jan 22, 2005 1:19 pm
And what's wrong with it?
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Sat Jan 22, 2005 1:24 pm
change
to
from php.net
For downward compatibility mysql_numrows() can also be used. This is deprecated however.
Terencentanio
Forum Commoner
Posts: 27 Joined: Mon Dec 06, 2004 10:32 am
Location: England
Post
by Terencentanio » Sat Jan 22, 2005 1:27 pm
That doesn't work either.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Sat Jan 22, 2005 1:36 pm
What exackly is being returned? Any output?
Are you sure your query is matching any rows?
Terencentanio
Forum Commoner
Posts: 27 Joined: Mon Dec 06, 2004 10:32 am
Location: England
Post
by Terencentanio » Sat Jan 22, 2005 1:41 pm
Yep. The "to" is the same as the "logged" ... but it won't return owt.
HormonX
Forum Commoner
Posts: 50 Joined: Tue Dec 10, 2002 7:43 pm
Location: Toronto
Post
by HormonX » Sat Jan 22, 2005 1:50 pm
$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
Terencentanio
Forum Commoner
Posts: 27 Joined: Mon Dec 06, 2004 10:32 am
Location: England
Post
by Terencentanio » Sat Jan 22, 2005 1:54 pm
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.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Sat Jan 22, 2005 1:59 pm
A longshot but try
Code: Select all
$msgs = "SELECT * FROM `rs2_msgs` WHERE `to` = '".trim($logged)."'";
mrmachoman
Forum Newbie
Posts: 5 Joined: Sat Jan 22, 2005 6:36 pm
Post
by mrmachoman » Sat Jan 22, 2005 10:35 pm
I fear you were having problems since "to" is a SQL reserved word. Be very careful when using reserved words in your DB.