Raised This Month: $ Target: $400
 0% 

Problems with SQLx Query...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rixorster
Senior Member
Join Date: Jul 2005
Old 01-10-2007 , 14:00   Problems with SQLx Query...
Reply With Quote #1

Well, meh function is like this:
Code:
public sqlx_test(id) {     new authid[32]     get_user_authid(id,authid,31)     new Handle:Query = SQL_PrepareQuery(g_SqlConnection,"SELECT job FROM accounts WHERE steamid='%s'",authid);     SQL_Execute(Query)     if(!SQL_Execute(Query))     {         // if there were any problems         SQL_QueryError(Query,g_Error,511)         set_fail_state(g_Error)     }     StoreOther = SQL_ReadResult(Query, 0)     client_print(id,print_chat,"[SQLx Test] Found data : %d ",StoreOther)     SQL_FreeHandle(Query) }
It says something like(Not sure but): [MySQL] No result from this query.
What's wrong with it?
Oh, and meh plugin_init is:
Code:
public plugin_init() {     // Registering     register_plugin("Items 2.0", "0.1b", "Rixorster")     // Console Commands     register_concmd("item_aidkit","item_aidkit")     register_concmd("item_emergencykit","item_emergencykit")     register_concmd("item_tazer","item_tazer")     register_concmd("item_lockpick","item_lockpick")     register_concmd("sqlx_test","sqlx_test")     // Client Commands     register_clcmd("say /trigger","Handle_Use")     register_clcmd("say /jail","Handle_Jail")     // Cvars     register_cvar("hrp_sql_host","127.0.0.1")     register_cvar("hrp_sql_user","root")     register_cvar("hrp_sql_pass","lollero")     register_cvar("hrp_sql_db","economy")     // SQLx     new host[64], user[64], pass[64], db[64], error[255];     get_cvar_string( "hrp_sql_host", host, 63 );     get_cvar_string( "hrp_sql_user", user, 63 );     get_cvar_string( "hrp_sql_pass", pass, 63 );     get_cvar_string( "hrp_sql_db", db, 63 );         g_SqlTuple = SQL_MakeDbTuple(host,user,pass,db);     new errorcode     g_SqlConnection=SQL_Connect(g_SqlTuple,errorcode,error,254);     if (!g_SqlConnection)     {         console_print(0,"[HRPi] Server cannot connect to database.")         console_print(0,"[HRPi] Error(%d): %s",errorcode,error)         return     }     console_print(0,"[HRPi] SQLx Connection Succesfull!") }
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
lunarwolfx
Member
Join Date: Feb 2005
Old 01-10-2007 , 17:21   Re: Problems with SQLx Query...
Reply With Quote #2

Here is your problem.

Code:
    new Handle:Query = SQL_PrepareQuery(g_SqlConnection,"SELECT job FROM accounts WHERE steamid='%s'",authid);

It's SELECT * job
lunarwolfx is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 01-10-2007 , 18:05   Re: Problems with SQLx Query...
Reply With Quote #3

What does the * do?
Bad_Bud is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 01-10-2007 , 20:45   Re: Problems with SQLx Query...
Reply With Quote #4

Code:
    SQL_Execute(Query)     if(!SQL_Execute(Query))

You have two SQL_Execute here too. You should remove one of them.

Code:
SELECT * FROM ...
^--- This means select all columns FROM the table.

Code:
SELECT `job` FROM ...
^---This means only select the job column from the table.

Don't use SELECT * job. I believe that incorrect.

Other than that I do not see anything wrong with the code or the row for that steamid does not exist
__________________
No private support via Instant Message
GunGame:SM Released

Last edited by teame06; 01-10-2007 at 20:52.
teame06 is offline
Send a message via AIM to teame06
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 01-10-2007 , 22:40   Re: Problems with SQLx Query...
Reply With Quote #5

Would SELECT * FROM tablename WHERE blah='blah'

Give you all of the columns, or would it give you all of the columns except for blah?
Bad_Bud is offline
lunarwolfx
Member
Join Date: Feb 2005
Old 01-10-2007 , 22:45   Re: Problems with SQLx Query...
Reply With Quote #6

bleh, you're right, it's not SELECT * job, I kinda jumped the gun on that one.

@bad_bud, that would give you the columns in which the blah column is equal to "blah"
lunarwolfx is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 22:20.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode