PDA

View Full Version : Problem with a script after upgrading to mySQL 5 and PHP 5


Cloud Strife
04-05-2007, 05:14 PM
I run a script and I get a mysql 1604 error on ths piece of code.

$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET thetime = '$currentunixtime'
WHERE username = '$theuser'; ");


I get this error


Invalid SQL:

UPDATE user
SET thetime = '1175797034'
WHERE username = 'Rowuy')';;

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
Error Number : 1064

It worked prior to the upgrade but no longer works. Any ideas?

Adrian Schneider
04-05-2007, 05:39 PM
$username = $vbulletin->db->escape_string($theuser);

$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET thetime = $currentunixtime
WHERE username = '$username'
");

Cloud Strife
04-05-2007, 06:21 PM
Thanks a lot, it's working perfectly now :)

Cloud Strife
04-06-2007, 10:30 PM
I have one last script thats causing me troubles. I get this error:-

Fatal error: Cannot use object of type vB_Session as array in et/home/siteupload/public_html/forums/showthread.php(1953) : eval()'d code on line 33

From this line of code:-

while ($user = $db->fetch_array($result))
{
array_push($viewers, "<a target=\"_blank\" href=\"member.php?".$vbulletin->session['sessionurl'] . "u=".$user['userid'] . "\">" . htmlspecialchars($user['username']) . "</a>");
}

Thanks for the help :)

Adrian Schneider
04-06-2007, 10:49 PM
$vbulletin->session->vars['sessionurl']
instead of
$vbulletin->session['sessionurl']

Cloud Strife
04-07-2007, 10:35 AM
Really appreciate the help. Things are in tip top working condition now :p