Raised This Month: $ Target: $400
 0% 

using sql with amxx


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sonic7145
Member
Join Date: Jul 2005
Location: USA
Old 01-06-2006 , 20:07   using sql with amxx
Reply With Quote #1

pruned

Last edited by Sonic7145; 08-09-2021 at 04:05.
Sonic7145 is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 01-06-2006 , 20:32  
Reply With Quote #2

Read some plugins that use SQL. I think your best bet would probably be to search for plugins by Suicid3, he uses SQL a lot.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Old 01-06-2006, 20:54
Sonic7145
This message has been deleted by Sonic7145.
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 01-06-2006 , 21:07  
Reply With Quote #3

Quote:
Originally Posted by Hawk552
Read some plugins that use SQL. I think your best bet would probably be to search for plugins by Suicid3, he uses SQL a lot.
Not a lot. lol. But yes I do. A lot of mine use files not SQL.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Old 01-06-2006, 23:08
Sonic7145
This message has been deleted by Sonic7145.
Des12
Senior Member
Join Date: Jan 2005
Old 01-06-2006 , 23:17  
Reply With Quote #4

Bascially like this:
Code:
dbc = dbi_connect(host,username,password,dbname,error,32) //have to assign own info for the first 4 if (dbc == SQL_FAILED) {         server_print("[AMXX] Could Not Connect To SQL Database^n") }
__________________
-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
Old 01-07-2006, 12:27
Sonic7145
This message has been deleted by Sonic7145.
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 01-07-2006 , 17:00  
Reply With Quote #5

That wont quite work. Use:
Code:
sql = dbi_connect(host,username,password,dbname,error,125) if( sql > SQL_FAILED ) {     server_print( "[AMXX] Connected")    //If this point is reached you need to use dbi_close( sql ) } else {     server_print("[AMXX] Failed to connect. Error: %s" , error)     //If this point is reached you do not use dbi_close( sql ) }
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Old 01-07-2006, 17:57
Sonic7145
This message has been deleted by Sonic7145.
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 01-07-2006 , 17:59  
Reply With Quote #6

Quote:
Originally Posted by Sonic7145
and the problem, when a client joins:

L 01/07/2006 - 14:54:11: [MYSQL] Invalid database handle 0
L 01/07/2006 - 14:54:11: [AMXX] Run time error 10 (plugin "sqltest.amxx") - debug not enabled!
L 01/07/2006 - 14:54:11: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).

Hmm... Let see.. This is trying to tell you to enable debug on that plugin =)
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Old 01-07-2006, 18:01
Sonic7145
This message has been deleted by Sonic7145.
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 01-07-2006 , 18:20  
Reply With Quote #7

make
Code:
new Sql:dbc
global and then take it out of both functions.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Old 01-07-2006, 19:26
Sonic7145
This message has been deleted by Sonic7145.
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 01-07-2006 , 20:19  
Reply With Quote #8

Please readup on how to use dbi you cannot use dbi_numrows(result) if the result failed. use something similar to the following.
Code:
result = dbi_query(dbc,"SELECT * FROM `steamids` WHERE `steamid` = '%s' LIMIT 0 , 1", usersteam) if( result <= RESULT_FAILED ) {     //Log failed message here } else if( result == RESULT_NONE ) {     //No results returned.     //Use dbi_free_result(result) } else {     //Results returned use dbi_result() or dbi_field() now.     //Use dbi_free_result( result ) }
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Old 01-07-2006, 21:11
Sonic7145
This message has been deleted by Sonic7145.
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 15:55.


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