Raised This Month: $ Target: $400
 0% 

Little help on this?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
TheNewt
Donor
Join Date: Jun 2006
Location: Where I live.
Old 07-02-2006 , 18:57   Little help on this?
Reply With Quote #1

Did I do this correctly? Its for a plugin to create a mysql entry and retrieve it later.
Code:
public client_disconnect(id) {     new player_name[33]     new authid[32]     new playtime = get_user_time (id)     get_user_authid(id,authid,31)     get_user_name(id,player_name,31)     if (g_ConnectTime[id]== 0) {         result = dbi_query(dbc,"INSERT INTO MySQLTest (player, steamid, connecttime, playerlevel, playerxp, date) values ('%s','%s',%i,%i,%i,NOW())",player_name,authid,playtime,g_PlayerLevel[id],g_PlayerXP[id])     }     else {         new store_time = (playtime + g_ConnectTime[id])         result = dbi_query(dbc,"UPDATE MySQLTest SET player='%s', connecttime=%i, playerlevel=%i, playerxp=%i, date=NOW() WHERE steamid='%s'",player_name,store_time, g_PlayerLevel[id],g_PlayerXP[id],authid)     } } /*------------------------------------------------------------------------------------------------*/ public client_authorized(id) {     new authid[32]     get_user_authid(id,authid,31)         result = dbi_query(dbc,"SELECT * FROM MySQLTest WHERE steamid = '%s'",authid)     if (result == RESULT_FAILED) {         log_amx("[MySQL Test] MySQL Query Failed!!")         return PLUGIN_CONTINUE     }     else if (result == RESULT_NONE) {         g_ConnectTime[id] = 0         g_PlayerLevel[id] = 0         g_PlayerXP[id] = 0     }     else {         dbi_nextrow(result)         g_ConnectTime[id] = dbi_result(result,"connecttime")         g_PlayerLevel[id] = dbi_result(result, "playerlevel")         g_PlayerXP[id]= dbi_result(result, "playerxp")     }     dbi_free_result(result)     return PLUGIN_HANDLED; }

JUST tried it out on my plugin, IT WORKS!!!!!!!!!!! Saves to MySQL and Loads from it too!!

Last edited by TheNewt; 07-02-2006 at 20:15.
TheNewt is offline
 


Thread Tools
Display Modes

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 07:56.


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