1
MS-2001
sql is driving me mad
  • 2004/11/20 21:17

  • MS-2001

  • Quite a regular

  • Posts: 204

  • Since: 2004/7/27


why the hell isnt it working?
i want to realise a ignorelist for the pm system.
$ignore $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("users_ignore")." WHERE uid=$uid AND ignore_uid=".$row->from_userid);
          if (
$xoopsDB->getRowsNum($ignore) > 0) {
              
$delete mysql_query("DELETE FROM ".$xoopsDB->prefix("priv_msgs")." WHERE msg_id=".$row->msg_id);
              
              
$update $xoopsDB->query("SELECT msg_id FROM ".$xoopsDB->prefix("priv_msgs_backup")." WHERE from_userid=".$row->from_userid." AND to_userid=$uid AND msg_time=".$row->msg_time);
              
$updaterow mysql_fetch_array($update);
              
$updatenow mysql_query("UPDATE ".$xoopsDB->prefix("priv_msgs_backup")." SET ignore_msg=1 WHERE msg_id=".$updaterow->msg_id);
          } else {
              echo 
"openWithSelfMain('".XOOPS_URL."/modules/system/showpn.php?msg_id=".$row->msg_id."', 'showpn".$i."', 550, 400);";
              
$i++;
          }


$updaterow->msg_id is allways '' but when i check the result with phpmyadmin there MUST be a result

2
Mithrandir
Re: sql is driving me mad

$ignore $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("users_ignore")." WHERE uid=$uid AND ignore_uid=".$row->from_userid);
if (
$xoopsDB->getRowsNum($ignore) > 0) {
    
$delete mysql_query("DELETE FROM ".$xoopsDB->prefix("priv_msgs")." WHERE msg_id=".$row->msg_id);
              
    
$update $xoopsDB->query("SELECT msg_id FROM ".$xoopsDB->prefix("priv_msgs_backup")." WHERE from_userid=".$row->from_userid." AND to_userid=$uid AND msg_time=".$row->msg_time);
    
$updaterow $xoopsDB->fetchArray($update);
    
$updatenow $xoopsDB->query("UPDATE ".$xoopsDB->prefix("priv_msgs_backup")." SET ignore_msg=1 WHERE msg_id=".$updaterow['msg_id'});
} else {
    echo 
"openWithSelfMain('".XOOPS_URL."/modules/system/showpn.php?msg_id=".$row->msg_id."', 'showpn".$i."', 550, 400);";
    
$i++;
}


You don't get an object back from fetch_array - you get an array. Therefore you should use $updaterow['msg_id'] instead of $updaterow->msg_id

3
MS-2001
Re: sql is driving me mad
  • 2004/11/21 12:53

  • MS-2001

  • Quite a regular

  • Posts: 204

  • Since: 2004/7/27


ah, thx a lot

Login

Who's Online

265 user(s) are online (224 user(s) are browsing Support Forums)


Members: 0


Guests: 265


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits