PDA

View Full Version : query written wrong


sabret00the
01-20-2005, 02:45 PM
$DB_site->query("
UPDATE grps_post(pagetext, edit_username, edit_userid, edit_reason, edit_dateline, allowsmilie)
VALUES ('" . addslashes($newpost['message']) . "', '" . addslashes($bbuserinfo[username] . "', '" . $bbuserinfo[userid] . "', '" . addslashes($edit['reason']) . "', " . TIMENOW . ", 1)
WHERE postid = $postid
");

how should this be written?

Dean C
01-20-2005, 03:04 PM
That is the syntax for an INSERT query. Take a look here:

http://dev.mysql.com/doc/mysql/en/UPDATE.html

e.g.


UPDATE
table
SET field = '$value'
,field1 = '$value1'
,field2 = '$value2'
WHERE
field = '$value3'

sabret00the
01-20-2005, 03:06 PM
i so knew you were gonna say that :( thanks dean :)

this is spitting out an error
$DB_site->query("
UPDATE grps_post
SET pagetext = '" . addslashes($newpost[message]) . "',
edit_username = '" . addslashes($bbuserinfo[username] . "',
edit_userid = '" . $bbuserinfo[userid] . "',
edit_reason = '" . addslashes($edit[reason]) . "',
edit_dateline = " . TIMENOW . ",
allowsmilie = 1
WHERE postid = $postid
");

Parse error: parse error, unexpected ';' in groups\appendpost.php on line 263

Revan
01-20-2005, 04:23 PM
edit_username = '" . addslashes($bbuserinfo[username] . "', this line lacks a closing ) :)

sabret00the
01-20-2005, 04:49 PM
thanks :)