MySQL Error: 1064: You have an error in your SQL syntax...

Requests, feedback, and general discussion about WoWRoster
DO NOT post topics about WoWRoster AddOns here!

MySQL Error: 1064: You have an error in your SQL syntax...

Postby dimzen » Wed Apr 18, 2007 11:13 pm

If I run roster diag, this error come:
List of tables in [f-roster]

DB Error, could not list tables
MySQL Error: 1064: 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 '-roster' at line 1


and

Roster DB Layer

Invalid query result passed
Backtrace (most recent call last):

* File: /home/public_html/roster/lib/commonfunctions.lib.php
o line 248
o function called: backtrace
* File: /home/public_html/roster/lib/wowdb.php
o line 265
o function called: die_quietly
o args: Invalid query result passed, Roster DB Layer
* File: /home/public_html/roster/rosterdiag.php
o line 426
o function called: free_result
o args:


Haven't seen any errors when using roster? So it's like it's working, but why the diag errors then? :scratch:

Link to "my" roster


Edit..
Btw.. it came after I moved the homepage to a new host.
Last edited by dimzen on Wed Apr 18, 2007 11:17 pm, edited 3 times in total.
dimzen
WR.net Apprentice
WR.net Apprentice
 
Posts: 18
Joined: Mon Jan 08, 2007 6:20 pm

Re: MySQL Error: 1064: You have an error in your SQL syntax...

Postby shaun.voysey » Wed Apr 18, 2007 11:51 pm

List of tables in [f-roster]

DB Error, could not list tables
MySQL Error: 1064: 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 '-roster' at line 1



This seems to come from the 'SHOW TABLES' SQL command in rosterdiag.php.


replace
Code: Select all
$result = $wowdb->query("SHOW TABLES FROM $db_name");

with
Code: Select all
$result = $wowdb->query("SHOW TABLES");


To my mind the 'FROM $db_name' is redundent due to the fact you are using only one database.
User avatar
shaun.voysey
WR.net Apprentice
WR.net Apprentice
 
Posts: 70
Joined: Thu Aug 10, 2006 12:50 pm
Location: Berkshire, England

MySQL Error: 1064: You have an error in your SQL syntax...

Postby PleegWat » Thu Apr 19, 2007 12:46 am

A - in a db name isn't too good an idea. I guess it's allowed, and it should usually work since all db/table names should be quoted anyway, but a - is a character with a special meaning, and if the DB name is used unquoted, like here, it causes a parsing error.

Better stick to a-zA-Z0-9_
Last edited by PleegWat on Thu Apr 19, 2007 12:46 am, edited 1 time in total.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: MySQL Error: 1064: You have an error in your SQL syntax.

Postby dimzen » Thu Apr 19, 2007 1:41 am

shaun.voysey wrote:
List of tables in [f-roster]

DB Error, could not list tables
MySQL Error: 1064: 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 '-roster' at line 1



This seems to come from the 'SHOW TABLES' SQL command in rosterdiag.php.


replace
Code: Select all
$result = $wowdb->query("SHOW TABLES FROM $db_name");

with
Code: Select all
$result = $wowdb->query("SHOW TABLES");


To my mind the 'FROM $db_name' is redundent due to the fact you are using only one database.


That worked :D
dimzen
WR.net Apprentice
WR.net Apprentice
 
Posts: 18
Joined: Mon Jan 08, 2007 6:20 pm

Re: MySQL Error: 1064: You have an error in your SQL syntax.

Postby dimzen » Thu Apr 19, 2007 1:43 am

PleegWat wrote:A - in a db name isn't too good an idea. I guess it's allowed, and it should usually work since all db/table names should be quoted anyway, but a - is a character with a special meaning, and if the DB name is used unquoted, like here, it causes a parsing error.

Better stick to a-zA-Z0-9_


Shouldn't I get errors from other mySQL-using-stuff?
Roster has no other probs then the diag-thing, and phpbb works like it should.
dimzen
WR.net Apprentice
WR.net Apprentice
 
Posts: 18
Joined: Mon Jan 08, 2007 6:20 pm

MySQL Error: 1064: You have an error in your SQL syntax...

Postby PleegWat » Thu Apr 19, 2007 10:37 pm

Specifically for the dbname, you won't get errors because it only has very few references in the code. The problem also only shows up if the dbname is unquoted.

Code: Select all
SHOW TABLES FROM `f-roster`;


works.

Code: Select all
SHOW TABLES FROM f-roster;


Doesn't.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: MySQL Error: 1064: You have an error in your SQL syntax.

Postby dimzen » Fri Apr 20, 2007 2:20 am

PleegWat wrote:Specifically for the dbname, you won't get errors because it only has very few references in the code. The problem also only shows up if the dbname is unquoted.

Code: Select all
SHOW TABLES FROM `f-roster`;


works.

Code: Select all
SHOW TABLES FROM f-roster;


Doesn't.


Ohh.. okay.. thanks for that info :blackeye:
dimzen
WR.net Apprentice
WR.net Apprentice
 
Posts: 18
Joined: Mon Jan 08, 2007 6:20 pm


Return to General Support & Feedback

Who is online

Users browsing this forum: No registered users and 1 guest

cron