just another php n00b lookin for answers...
im trying to install a instant messenger system for phpnuke. Comes with 2 php files.
BlockMessenger.php in the root phpnuke directory.
and block-messenger.php in ../blocks
here is the error its giving me
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in BlockMessenger.php on line 196
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in BlockMessenger.php on line 198
here are lines 196 and 198
$member_online_num = mysql_num_rows($sql);
while ($session = mysql_fetch_array($sql)) {
and here is where $sql is defined
$sql = mysql_query("SELECT username FROM $prefix"._session." where guest=0");
any ideas?
PHPNuke SQL Error (installing messenger)
Moderator: General Moderators
Code: Select all
.$session.- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Should it maybe be:
One thing that can make it a lot easier to debug SQL statements is to change the code from:
as using mysql_error() and an or die() statement should give you a more useful (MySQL generated) error message.
Mac
Code: Select all
$sql = mysql_query("SELECT username FROM ".$prefix."_session WHERE guest=0");Code: Select all
$sql = "SELECT username FROM $prefix"._session." WHERE guest=0";
$result = mysql_query($sql) or die(mysql_error().'<p>'.$sql.'</p>');
$member_online_num = mysql_num_rows($result);
while ($session = mysql_fetch_array($result)) {Mac