PDA

View Full Version : Error, why?


hubba
05-09-2004, 03:29 PM
Just tring to get the chat "whos online" to work. Gives an error 1064 in VB3

--------------------
<?php
require("global.php");
if( $bbuserid ) {

$DB_site->query("UPDATE user SET inchat='0' WHERE userid='$bbuserinfo[userid]'");
$DB_site->query("UPDATE user SET lastchatactivity=$lastvisit WHERE userid='$bbuserinfo[userid]'");
} else {

} // end if
?>
<head>
<title>Chat Log-Out</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<BODY onLoad="setTimeout(window.close, 5000)"
</body>
</html>
-------------------

it comes

Ungueltige SQL-Abfrage: UPDATE user SET lastchatactivity= WHERE userid='1'
mysql error: You have an error in your SQL syntax.

Any idea perhaps?

assassingod
05-09-2004, 04:01 PM
Try using

$DB_site->query("UPDATE user SET lastchatactivity = '$lastvisit' WHERE userid='$bbuserinfo[userid]'");


for the second query. The query is saying that there isn't a value for $lastvisit so that's maybe why youre getting the error. Make sure $lastvisit has a value too.

hubba
05-12-2004, 02:39 PM
Ah thx a lot, that worked. But there is also something wrong, the script was for VB 2, perhaps you can telle me what to change for VB3?

----------------
<?
if ($showforumusers) {
$datecut = $ourtimenow - $cookietimeout;
$chat = '';
$comma = '';
$forumusers = $DB_site->query("SELECT username, invisible, userid
FROM user
WHERE inchat = 1 AND
lastchatactivity > $datecut");
while ($forumuser = $DB_site->fetch_array($forumusers)) {
if (!$forumuser['invisible'] or $bbuserinfo['usergroupid'] == 6) {
$userid = $forumuser['userid'];
$username = $forumuser['username'];
if ($forumuser['invisible'] == 1) { // Invisible User but show to Admin
$invisibleuser = '*';
} else {
$invisibleuser = '';
}
eval("\$chat .= \"".$comma.gettemplate('forumdisplay_loggedinuser')."\";");
$comma = ', ';
}
}

}
?>

Velocd
05-12-2004, 05:30 PM
Replace:
eval("\$chat .= \"".$comma.gettemplate('forumdisplay_loggedinuser')."\";");

With:
eval('$chat.= "' . $comma . fetch_template('forumdisplay_loggedinuser') . '";');

I'm not sure what kind of chat you have, but if it's IRC I suggest taking a look at the vB3 mIRC & Eggdrop hacks I have for displaying who is online from your chat (see my sig).

hubba
05-12-2004, 05:36 PM
Thanks, Velocd, I try it. Its an IRC chat, but my provider does not allow eggdrops. I also tried the Mirc Script but I am not online day and night. So I try to get this to work:

https://vborg.vbsupport.ru/showthread.php?p=508168#post508168