I need to check if a mysql row exists for the visiting user ($vbulletin->userinfo['userid']). I am using the below code but am getting an error at the top of the pages.
PHP Code:
if (!isset($_REQUEST['do'])) {
$uid = $vbulletin->userinfo['userid'];
$check = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "banners WHERE userid = '$uid'");
$result = mysql_num_rows($check);
if ($result !== "0") {
$bannerinfo = $db->query_first("SELECT status FROM " . TABLE_PREFIX . "banners WHERE userid = '$uid'");
if ($bannerinfo[status] == "declined") {
$_REQUEST['do'] = "add";
} else {
$_REQUEST['do'] = "statistics";
}
} else {
$_REQUEST['do'] = "add";
}
}
Code:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /banners.php on line 58