PDA

View Full Version : mysql syntax error>_>


AN-net
08-17-2005, 04:25 PM
ok well i am completely confused to why this happening

the error is

Database error in vBulletin 3.0.7:

Invalid SQL:
INSERT INTO journals
(journalist, journalist_id, journaldate,
journaldesc, private, allowbuddies, whocanview, lastentry,
lastentry_date, lastentry_misc, ipaddress, entrycount, active,privatecount
)
VALUES
('Antonbomb22', '20',
1124306286, '', 0, , '',
'testing private entry', 1124306286,'a:3:{s:7:\"private\";i:1;s:10:\"whocanview\";s:0:\"\";s:12:\"allowbuddies\";i:0;}', '69.141.184.51'
,1,1,1
)

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 ' '',
'testing private entry', 1124306286,'a:3:{s:7:\"private\";i:1;s:10:' at line 8

mysql error number: 1064


this is the php code/query:

$DB_site->query("
INSERT INTO ".TABLE_PREFIX."journals
(journalist, journalist_id, journaldate,
journaldesc, private, allowbuddies, whocanview, lastentry,
lastentry_date, lastentry_misc, ipaddress" . ($journal['usejournalname'] ? ', journalname' : '') . "" . ($setting['autoapprove_entries']==1 ? ', entrycount' : '') . "" . ($setting['autoapprove_journals']==1 ? ', active' : '') . "" . ($addto['privatecount'] ? ',privatecount': '') . "
)
VALUES
('" . addslashes($bbuserinfo['username']) . "', '" . intval($bbuserinfo['userid']) . "',
" . TIMENOW . ", '" . addslashes($journal['description']) . "', " . $journal['private'] . ", " . $journal['allowbuddies'] . ", '" . addslashes($journal['whocanview']) . "',
'" . addslashes($entry['title']) . "', " . TIMENOW . ",'". addslashes($lastentrymisc) ."', '" . IPADDRESS . "'
" . ($journal['usejournalname'] ? $nameformat : '') . "" . ($setting['autoapprove_entries']==1 ? ',1' : '') . "" . ($setting['autoapprove_journals'] ? ',1' : '') . "" . ($addto['privatecount'] ? ',1' : '') . "
)
");


also why is there a 1 after 'active' and a 11 at the end of values. those should not be there.

any help would be appreciated.

edit:
fixed my active and stuff problems but still getting syntax error>_>

Marco van Herwaarden
08-17-2005, 08:27 PM
Try using a value for allowbuddies (0, '' or NULL).

I don't see an 11.

AN-net
08-17-2005, 09:15 PM
Try using a value for allowbuddies (0, '' or NULL).

I don't see an 11.
ooo it worked, i think it was combination of that and several other things.
thank you so much

Marco van Herwaarden
08-17-2005, 09:21 PM
No problem. :D