Log in

View Full Version : SQL error help!


LauraFL
03-07-2005, 06:06 PM
I am getting the following error when people try to open certain threads and any sticky post...

Invalid SQL:
SELECT MAX(dateline) AS lastpost, COUNT(*) AS total
FROM vb_usernote AS usernote
WHERE userid =

mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

mysql error number: 1064



I am not sure where the error is occuring or how to fix it. Can someone help me?

Marco van Herwaarden
03-07-2005, 06:39 PM
Did you install any hacks recently?

The reason for the error is clear, there is no userid in teh WHERE clause. On what script you get this error?

LauraFL
03-07-2005, 06:41 PM
I get it at alot of places...

Date: Monday 07th of March 2005 03:30:11 PM
Script: http://www.sunshinestatemoms.com/forum/showthread.php?t=393
Referer: http://www.sunshinestatemoms.com/forum/search.php?searchid=13400

Date: Monday 07th of March 2005 03:29:41 PM
Script: http://www.sunshinestatemoms.com/forum/showthread.php?t=514


Those are the 2 most recent

Marco van Herwaarden
03-07-2005, 06:45 PM
Please open your member.php file and find:
// display user info

Copy & paste the 10-15 lines after that here (use [ php] tags)

LauraFL
03-07-2005, 06:54 PM
$userperms = cache_permissions($userinfo, false);

if ((($userid == $bbuserinfo['userid'] AND $permissions['genericpermissions'] & CANVIEWOWNUSERNOTES) OR ($userid != $bbuserinfo['userid'] AND $permissions['genericpermissions'] & CANVIEWOTHERSUSERNOTES)) AND $userperms['genericpermissions'] & CANBEUSERNOTED)
{
$show['usernotes'] = true;
$usernote = $DB_site->query_first("
SELECT MAX(dateline) AS lastpost, COUNT(*) AS total
FROM " . TABLE_PREFIX . "usernote AS usernote
WHERE userid = $userinfo[userid]
");
$show['usernotetotal'] = iif($usernote['total'], true, false);
$usernote['lastpostdate'] = vbdate($vboptions['dateformat'], $usernote['lastpost'], true);
$usernote['lastposttime'] = vbdate($vboptions['timeformat'], $usernote['lastpost'], true);
}
else
{
$show['usernotes'] = false;
}

Marco van Herwaarden
03-07-2005, 06:59 PM
Hmm did you recently make any change to your includes/functions.php?

(probably in the function cache_permissions)

LauraFL
03-07-2005, 07:03 PM
I did when I was installing the arcade. Not the cache_permissions but some others.

Marco van Herwaarden
03-07-2005, 07:06 PM
I would double check those edits then. 99% chance that is where the error is.

YLP1
03-19-2005, 12:54 PM
I'm having the same problem....were you able to determine what was causing it?