MySQL Issue
#1

Hey guys, I'm wonderin' if you can help me with something. I've tried three separate queries, each... Have their own issues.

pawn Код:
format(bigstring, sizeof(bigstring), "SELECT ID,Username,Registered,FirstLogin,LastLogin,RegisteredIP,CharacterSlots,Banned,LastCreated,Muted FROM "SQL_ACC" WHERE Username = '%s'",GetName(playerid));
This one, works like a charm.

pawn Код:
format(bigstring, sizeof(bigstring), "SELECT ID,Username,Registered,FirstLogin,LastLogin,RegisteredIP,CharacterSlots,Banned,LastCreated,Muted,Group FROM "SQL_ACC" WHERE Username = '%s'",GetName(playerid));
^ Simply adding ",Group" to the query causes this:

Quote:

Error ID: 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 'Group FROM Accounts WHERE `Username` = 'Corello'' at line 1

pawn Код:
format(bigstring, sizeof(bigstring), "SELECT `ID`,`Username`,`Registered`,`FirstLogin`,`LastLogin`,`RegisteredIP`,`CharacterSlots`,`Banned`,`LastCreated`,`Muted`,`Group` FROM "SQL_ACC" WHERE Username = '%s'",GetName(playerid));
^ Works, but it causes the script to freeze and doesn't load the next line of code.

Ideas?
Reply
#2

We're kinda lacking information, keep in mind MySQL is case sensitive (at some points) and "Group" would not be the same as "group" when selecting rows.

The reason `..` works is because `` supressess errors, I believe.

My information may not be 100% correct, anyone is feel to correct me if I am to be mistaken.
Reply
#3

The table structure and case is correct, I've made sure of that already.

Pretty much, the first query works, it loads the characters and continues the script to do as it should.

The second obviously, has the MySQL issue which then stops the characters loading and then successfully loads later queries.

Quote:

[01:23:02] CMySQLHandler::Query(SELECT ID,Username,Registered,FirstLogin,LastLogin,Regist eredIP,CharacterSlots,Banned,LastCreated,Muted,Gro up FROM Accounts WHERE `Username` = 'Corello') - An error has occured. (Error ID: 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 'Group FROM Accounts WHERE `Username` = 'Corello'' at line 1)
[01:23:02] >> mysql_store_result( Connection handle: 1 )
[01:23:02] CMySQLHandler::StoreResult() - No data to store.
[01:23:02] >> mysql_fetch_row_format( Connection handle: 1 )
[01:23:02] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)
[01:23:02] >> mysql_free_result( Connection handle: 1 )
[01:23:02] CMySQLHandler::FreeResult() - The result is already empty.

And the third query just freezes the script after login and doesn't process any queries after it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)