AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   amxx 1.7, dbi, mysql 4.1 & advanced sql query problem :( (https://forums.alliedmods.net/showthread.php?t=25708)

onosrider 03-18-2006 21:49

amxx 1.7, dbi, mysql 4.1 & advanced sql query problem :(
 
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?

jtp10181 03-18-2006 21:58

and the error is....

Des12 03-18-2006 22:27

MYSQL queries often don't give errors

Code:
AS a, my_stats_2 AS b

Does what?

onosrider 03-18-2006 22:28

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)

jtp10181 03-18-2006 22:47

invalid result handle error you can get when you dont do proper error checking

Brad 03-18-2006 22:53

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.

jtp10181 03-19-2006 09:27

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.

Des12 03-19-2006 10:53

On compile they don't for me

jtp10181 03-19-2006 10:57

amxx compiler does not care about your mysql syntax.... :roll:
nor does it care about how well you have done error checking.

onosrider 03-19-2006 12:15

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


All times are GMT -4. The time now is 16:30.

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