SQL syntax error
#1

Hey, upon logging on my server I don't get the registration/login dialog, so I went to check the MySQL log for any sort of error that occured. Apparently, there is something wrong with one of my queries.

[ERROR] CMySQLQuery::Execute[OnAccountCheck(i)] - (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 ''accounts' WHERE 'Name'=Rudey LIMIT 1' at line 1

Is there anything wrong with: "SELECT 'Password', 'ID' FROM 'accounts' WHERE 'Name'=%e" ?

Thanks in advance!
Reply
#2

Try replacing the ' with `. eg. `Password`
Reply
#3

Ironically, the only thing that requires quotes is not in quotes ('%e'). Avoid backticks if you can. While they're the safest way to build a query, they also lengthen it and make it hard to read.
Reply
#4

Tried this: "SELECT `Password`, `ID` FROM `accounts` WHERE `Name`=`%e`" (With %e quoted, as Vince said) - Still doesn't work. I've also let the ticks I had initially, didn't work..
Reply
#5

Have you also tried this version?

Код:
SELECT Password, ID FROM accounts WHERE Name = '%e'
Reply
#6

Quote:
Originally Posted by Rudey
Посмотреть сообщение
Tried this: "SELECT `Password`, `ID` FROM `accounts` WHERE `Name`=`%e`" (With %e quoted, as Vince said) - Still doesn't work. I've also let the ticks I had initially, didn't work..
That's not what I said. I said '%e', not `%e`. Huge difference. Does your computer render them as the same thing?
Reply
#7

I'm aware. It works now, thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)