View Full Version : mysql error
Osterling
08-21-2004, 02:14 AM
I'm not sure if I can get support here since I downloaded this hack from another forum but it's a mysql problem and I was just hopeing some one here could provide me the answer:
Database error in vBulletin 3.0.0:
Invalid SQL:
SELECT u.username, j.journalid, j.title, j.description, j.timestamp, j.userid, j.entries, j.views
FROM journal j
LEFT JOIN user u ON u.userid = j.userid
WHERE j.enabled = 1
ORDER BY j.views DESC
LIMIT
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 6
mysql error number: 1064
Date: Friday 20th of August 2004 10:58:40 PM
Script: http://www.
Referer: http://www.
Username: exasko
IP Address:
Anyone have any idea to fix this?
Davey
08-21-2004, 02:36 AM
At a first glance, it looks like you are missing parameters for the LIMIT part.
LIMIT, as its name implies, limits your results to the set amount.
Ex:
|------table: vb3_bankbalance-------|
// not even remotely my real bank records, i wouldn't be that stupid.
id, in, out, balance
1, 0.00, 10.00, 560.00
2, 300.00, 0.00, 860.00
3, 0.00, 50.00, 810.00
4, 0.00, 20.00, 790.00
5, 100.00, 0.00, 890.00
6, 0.00, 500.00, 390.00
7, 100.00, 0.00, 490.00
|------end--------|
$DB_site->query("
SELECT balance
FROM " . TABLE_PREFIX . "mybankrecords
LIMIT 2,7
");
Should grab rows 2 -> 7 and leave row 1 in the database.
A 'LIMIT' can't have no parameters. That's probably why you are getting that error, anyway.
Osterling
08-21-2004, 02:40 AM
CREATE TABLE journal (
journalid int(11) NOT NULL auto_increment,
title text NOT NULL,
description text NOT NULL,
imagename text NOT NULL,
entries int(11) NOT NULL default '0',
views int(11) NOT NULL default '0',
enabled smallint(6) default '0',
timestamp int(11) NOT NULL default '0',
userid int(11) NOT NULL default '0',
mood text NOT NULL,
np text NOT NULL,
PRIMARY KEY (journalid)
) TYPE=MyISAM ;
thats the sql i ran, could you fix it to make it right because to be honest your post didn't make much sense to me :confused:
Davey
08-21-2004, 02:45 AM
Your SQL-query has been executed successfully
SQL-query :
CREATE TABLE journal ( journalid int(11) NOT NULL auto_increment, title text NOT NULL, description text NOT NULL, imagename text NOT NULL, entries int(11) NOT NULL default '0', views int(11) NOT NULL default '0', enabled smallint(6) default '0', timestamp int(11) NOT NULL default '0', userid int(11) NOT NULL default '0', mood text NOT NULL, np text NOT NULL, PRIMARY KEY (journalid) ) TYPE=MyISAM
Nothing wrong with that.
Osterling
08-21-2004, 02:47 AM
then i hate to sound stupid, but what should i do to fix this? i am really new to mysql..
is there something i could run to fix it, or do something? god i hate sounding stupid..
Davey
08-21-2004, 02:50 AM
Well I straight off ran that query copy + paste, and it executed it fine. Not sure why it isn't working in your case. What exactly is it saying? Have you tried running the query from phpMyAdmin? That is where I ran it from.
Osterling
08-21-2004, 02:52 AM
No it runs prefectly.. its when I try to view it.. see,
http://www.exasko.info/forum/journal.php
that is the problem i am getting..
Davey
08-21-2004, 02:55 AM
I just see "there has been a technical problem with the database" :p
Osterling
08-21-2004, 02:57 AM
Database error in vBulletin 3.0.0:
Invalid SQL:
SELECT u.username, j.journalid, j.title, j.description, j.timestamp, j.userid, j.entries, j.views
FROM journal j
LEFT JOIN user u ON u.userid = j.userid
WHERE j.enabled = 1
ORDER BY j.views DESC
LIMIT
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 6
mysql error number: 1064
Date: Friday 20th of August 2004 11:55:56 PM
Script: http://www.exasko.info/forum/journal.php
Referer:
that is the error i get on that page..
Davey
08-21-2004, 03:00 AM
Open up 'journal.php' in your favourite editor.
Find the line with the text:
"SELECT u.username, j.journalid, j.title, j.description, j.timestamp, j.userid, j.entries, j.views"
Paste all of the query including $DB_site->query bit.
Maybe put it inside [code] braces? :p
Osterling
08-21-2004, 03:04 AM
$journal_views = $DB_site->query("
SELECT u.username, j.journalid, j.title, j.description, j.timestamp, j.userid, j.entries, j.views
FROM journal j
LEFT JOIN user u ON u.userid = j.userid
WHERE j.enabled = 1
ORDER BY j.views DESC
LIMIT " . "$vboptions[journals_viewdisplaylimit]
");
that' it... thank you so much :)
Davey
08-21-2004, 03:07 AM
Could you try replacing it with this, and telling me what happens then?
$journal_views = $DB_site->query("
SELECT u.username, j.journalid, j.title, j.description, j.timestamp, j.userid, j.entries, j.views
FROM journal j
LEFT JOIN user u ON u.userid = j.userid
WHERE j.enabled = 1
ORDER BY j.views DESC
LIMIT $vboptions['journals_viewdisplaylimit']
");
Thanks.
Osterling
08-21-2004, 03:08 AM
i get this error:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/exas77ko/public_html/forum/journal.php on line 1211
Try this instead:
$limit_views = intval($vboptions['journals_viewdisplaylimit']);
$journal_views = $DB_site->query("SELECT u.username, j.journalid, j.title, j.description, j.timestamp, j.userid, j.entries, j.views FROM journal j LEFT JOIN user u ON u.userid = j.userid WHERE j.enabled = 1 ORDER BY j.views DESC LIMIT" . $limit_views);
Davey
08-21-2004, 03:11 AM
Ah, brad.loo to save the day. :p
edit. hey brad.loo, maybe you could help with my problem :devious: :p look about 10 threads down lol.
Osterling
08-21-2004, 03:12 AM
Try this instead:
$limit_views = intval($vboptions['journals_viewdisplaylimit']);
$journal_views = $DB_site->query("SELECT u.username, j.journalid, j.title, j.description, j.timestamp, j.userid, j.entries, j.views FROM journal j LEFT JOIN user u ON u.userid = j.userid WHERE j.enabled = 1 ORDER BY j.views DESC LIMIT" . $limit_views);
when i did that, i got this error
Database error in vBulletin 3.0.0:
Invalid SQL: SELECT u.username, j.journalid, j.title, j.description, j.timestamp, j.userid, j.entries, j.views FROM journal j LEFT JOIN user u ON u.userid = j.userid WHERE j.enabled = 1 ORDER BY j.views DESC LIMIT0
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 'LIMIT0' at line 1
mysql error number: 1064
Argh...damn array, use this:
$journal_views = $DB_site->query("SELECT u.username, j.journalid, j.title, j.description, j.timestamp, j.userid, j.entries, j.views FROM journal j LEFT JOIN user u ON u.userid = j.userid WHERE j.enabled = 1 ORDER BY j.views DESC LIMIT" . $vboptions['journals_viewdisplaylimit']);
Osterling
08-21-2004, 03:20 AM
Database error in vBulletin 3.0.0:
Invalid SQL: SELECT u.username, j.journalid, j.title, j.description, j.timestamp, j.userid, j.entries, j.views FROM journal j LEFT JOIN user u ON u.userid = j.userid WHERE j.enabled = 1 ORDER BY j.views DESC LIMIT
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 1
mysql error number: 1064
Date: Saturday 21st of August 2004 12:19:31 AM
Script: http://www.exasko.info/forum/journal.php
thats the error i get when made the other change
Wait, is the the journal script posted on evB? Last I heard that has alot more errors then just then one, just so you know.
You can try throwing this at it, are you sure you set up all the vBoptions for that script correctly?
$journal_views = $DB_site->query("SELECT u.username, j.journalid, j.title, j.description, j.timestamp, j.userid, j.entries, j.views FROM journal j LEFT JOIN user u ON u.userid = j.userid WHERE j.enabled = 1 ORDER BY j.views DESC LIMIT".$vboptions[journals_viewdisplaylimit]);
Altho im not sure why the single quotes in the array would throw it off any.
Osterling
08-21-2004, 04:21 AM
no.. didn't fixc the problem :(
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.