Raised This Month: $ Target: $400
 0% 

saving via sql


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-18-2011 , 21:24   Re: saving via sql
Reply With Quote #2

You would need a table like this:
- listname VARCHAR(10) NOT NULL (change 10 to however long you may need the name)
- listdata INT(11) NOT NULL (assumed an int based on the global variable)
- authid VARCHAR(35) NOT NULL
- PRIMARY KEY(listname, authid)

Then you can do this:
Code:
new szAuthID[ 35 ]; get_user_authid( iPlayer, szAuthID, charsmax( szAuthID ) ); new Handle:hQuery; for( new i; i < ilist; i++ ) {     hQuery = SQL_PrepareQuery( /* connection */,\         "INSERT INTO table \         (listname, listdata, authid) \         VALUES \         (^"%s^", %d, ^"%s^") \         ON DUPLICATE KEY UPDATE \         listdata = %d;",\         gListname[ i ], gPlayerListData[ iPlayer ][ i ], szAuthID, gPlayerListData[ iPlayer ][ i ] );         // execute query }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 04-19-2011 at 05:31.
Exolent[jNr] is offline
 



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 19:47.


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