Raised This Month: $ Target: $400
 0% 

Mysql result ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
MiniBrackeur
Senior Member
Join Date: Oct 2010
Old 02-21-2013 , 13:26   Mysql result ?
Reply With Quote #1

Hello, I search how to get a array from a query mysql ?

PHP Code:
new Handle:db;
public 
sql_init()
{
    new 
sqlhostname[35], sqluser[35], sqlpass[35], sqldbname[35], errcodeerror[128];
    
get_cvar_string("amx_sql_host"sqlhostname34);
    
get_cvar_string("amx_sql_user"sqluser34);
    
get_cvar_string("amx_sql_pass"sqlpass34);
    
get_cvar_string("amx_sql_db"sqldbname34);
    new 
Handle:tuple SQL_MakeDbTuple(sqlhostnamesqlusersqlpasssqldbname);
    
db SQL_Connect(tupleerrcodeerrorcharsmax(error));
    return 
PLUGIN_CONTINUE;
}
public 
end_notemap()
{
    new 
players[32], playerscount;
    
get_players(playersplayerscount"ch");
    for(new 
iplayerscounti++)
    {
        new 
id players[i];
        
menu_cancel(id);
    }
    
    new 
Handle:query SQL_PrepareQuery(db"SELECT `verygood`, `good`, `bad`, `verybad`, `none` FROM `cs_notemap` WHERE `map`='%s'"g_mapname);
    new 
result[4];
    
/*
        
        How to get the four result in the arry result ?
        
    */
    
g_vote_verygood += result[0];
    
g_vote_good += result[1];
    
g_vote_bad += result[2];
    
g_vote_verybad += result[3];
    
g_vote_none += result[4];
    
    
query SQL_PrepareQuery(db"UPDATE `cs_notemap` SET `verygood`='%d', `good`='%d', `bad`='%d', `verybad`='%d', `none`='%d' WHERE `map`='%s'"g_vote_verygoodg_vote_goodg_vote_badg_vote_verybadg_votenoneg_mapname);
    
SQL_Execute(query);
    
SQL_FreeHandle(query);
    
    return 
PLUGIN_HANDLED;

Very thank's !
__________________
MiniBrackeur => Daminou
MiniBrackeur 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 21:42.


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