PDA

View Full Version : Invalid SQL: UPDATE adv_links_categories SET


3lite
11-28-2008, 04:21 PM
Hello I have a fresh install of VBA links directory and I'm getting sql errors.


This error comes up after I edited a link listing.

Database error in vBulletin 3.7.4:

Invalid SQL:
UPDATE adv_links_categories SET
lastlinkid = '',
lastlinktitle = '',
lastlinkuserid = '',
lastlinkusername = '',
lastlinkdateline = ''
,
lastpostid = '',
lastpostlinkid = '',
lastpostlinktitle = '',
lastpostuserid = '',
lastpostusername = '',
lastpostdateline = ''
lastlinktitle = 'Washington Pages -- Seattle Business Directory' WHERE catid = 4;

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 'lastlinktitle = 'Washington Pages -- Seattle Business Directory' WHERE catid = 4' at line 14
Error Number : 1064
Request Date : Friday, November 28th 2008 @ 12:12:28 PM
Error Date : Friday, November 28th 2008 @ 12:12:28 PM
Script : http://blankmyblank.com/link-directory/addlink.php
Referrer : http://blankmyblank.com/link-directory/addlink.php?do=editlink&linkid=2
IP Address : Hidden
Username : Hidden
Classname : vB_Database
MySQL Version : 4.1.22-standard

After I go back... it seems fine and waiting for me in the moderation que.


Thanks!

- 3lite

Brian
11-29-2008, 12:39 PM
Thank you for pointing this out. I've just applied the fix to the forum/includes/vba_links_functions_savelink.php file in the download package here, so if you will update that file on your server with the new version, that should take care of the issue.
Or if you would rather apply the fix manually, just look in the file for this code:
if ($newlink['name'] != $oldlink['name'])
{
$upquerynew .= " lastlinktitle = '" . $db->escape_string($newlink['name']) . "'";
}


And replace with this:
if ($newlink['name'] != $oldlink['name'] AND $lastlink['linkid'])
{
$upquerynew .= iif($upquerynew, ',') . " lastlinktitle = '" . $db->escape_string($newlink['name']) . "'";
}