SA-MP Forums

Go Back   SA-MP Forums > SA-MP Server > Server Support

Reply
 
Thread Tools Display Modes
Old 31/07/2012, 12:11 AM   #1
CoCo-Corello
Little Clucker
 
Join Date: Jun 2012
Posts: 6
Reputation: 0
Default MySQL Issue

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

pawn Code:
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 Code:
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 Code:
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?
CoCo-Corello is offline   Reply With Quote
Old 31/07/2012, 12:17 AM   #2
Revo
Huge Clucker
 
Revo's Avatar
 
Join Date: Apr 2012
Location: The Netherlands
Posts: 261
Reputation: 80
Default Re: MySQL Issue

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.
__________________
(09:03:52) <+Redirect_Left> i am sat in just my boxers
(09:03:52) <+Redirect_Left> tbh.
(09:03:52) <Blake> cute
Revo is offline   Reply With Quote
Old 31/07/2012, 12:20 AM   #3
CoCo-Corello
Little Clucker
 
Join Date: Jun 2012
Posts: 6
Reputation: 0
Default Re: MySQL Issue

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.
CoCo-Corello is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue with mysql BLAbla93 Help Archive 1 12/05/2011 12:54 AM
MySQL issue [SAP]HighFlyer Help Archive 0 14/04/2011 06:21 PM
MySQL Issue Criss_Angel Help Archive 18 28/01/2011 07:27 PM
Mysql issue ihatetn931 Help Archive 0 14/08/2010 06:03 AM
mysql issue [RVRP]Tyler Server Support 18 19/07/2010 03:27 PM


All times are GMT. The time now is 06:24 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.