Raised This Month: $12 Target: $400
 3% 

amxx 1.7, dbi, mysql 4.1 & advanced sql query problem :(


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
onosrider
Member
Join Date: Jul 2005
Old 03-18-2006 , 21:49   amxx 1.7, dbi, mysql 4.1 & advanced sql query problem :(
Reply With Quote #1

i use the same code for two plugins to test someting, but i always get errors with longer and more advanced sql querys.

a verry simple one works perfect:
Code:
result = dbi_query(dbc,"SELECT rank FROM my_stats WHERE steamid='%s'",authid)

but this one dosen't:
Code:
result = dbi_query(dbc,"SELECT a.userid, a.rank, b.userid, b.kills, b.onlinetime FROM my_stats AS a, my_stats_2 AS b WHERE a.userid = b.userid AND steamid='%s'",authid)

can anyone tell me why?
__________________

onosrider is offline
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 03-18-2006 , 21:58  
Reply With Quote #2

and the error is....
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
Des12
Senior Member
Join Date: Jan 2005
Old 03-18-2006 , 22:27  
Reply With Quote #3

MYSQL queries often don't give errors

Code:
AS a, my_stats_2 AS b

Does what?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
onosrider
Member
Join Date: Jul 2005
Old 03-18-2006 , 22:28  
Reply With Quote #4

i have to setup a testserver again and debug...

Quote:
L 03/19/2006 - 02:09:00: [AMXX] Run time error 10 (plugin "sqltest.amxx") - debug not enabled!
L 03/19/2006 - 02:09:01: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 03/19/2006 - 02:09:14: [MYSQL] Invalid result handle -1
code now:
Code:
new rank[32]         dbi_nextrow(result)         dbi_result(result,"rank",rank,32)

the only i do not know is, do i have to add a. and b. in dbi_result?

example...?
Code:
new rank[32]         dbi_nextrow(result)         dbi_result(result,"a.rank",rank,32)
__________________

onosrider is offline
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 03-18-2006 , 22:47  
Reply With Quote #5

invalid result handle error you can get when you dont do proper error checking
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 03-18-2006 , 22:53  
Reply With Quote #6

Quote:
Originally Posted by Des12
MYSQL queries often don't give errors
How sure are you about that? It's been my experience that I always get an error if one occurs.
Brad is offline
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 03-19-2006 , 09:27  
Reply With Quote #7

Quote:
Originally Posted by Brad
Quote:
Originally Posted by Des12
MYSQL queries often don't give errors
How sure are you about that? It's been my experience that I always get an error if one occurs.
yeah, it always gives errors if there is one, mysql is very picky about syntax and it does not quietly ignore your problem.
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
Des12
Senior Member
Join Date: Jan 2005
Old 03-19-2006 , 10:53  
Reply With Quote #8

On compile they don't for me
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 03-19-2006 , 10:57  
Reply With Quote #9

amxx compiler does not care about your mysql syntax....
nor does it care about how well you have done error checking.
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
onosrider
Member
Join Date: Jul 2005
Old 03-19-2006 , 12:15  
Reply With Quote #10

my query string works, it is something about amxx, this for sure.
__________________

onosrider 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 18:59.


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