Raised This Month: $ Target: $400
 0% 

Solved Print stuff from database


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
4ever16
Veteran Member
Join Date: Apr 2015
Old 06-04-2018 , 10:58   Print stuff from database
Reply With Quote #1

I have a database which is called player_player. In that database i have following.

Username | Steam id | Kills | Deaths | Headshots | Points

I have a plugin which prints out my points like this: [SERVERNAME] Your points 1000
I would like it to print out more stuff like kills & deaths but dont have a clue how to.


PHP Code:
public showPlayerRank(id)
{
    static 
query[512];
    
formatex(querycharsmax(query), "SELECT COUNT(*) FROM player_player WHERE points > '%d'"pPoints[id]);
    
log_amx(query)
    static 
data[2];
    
data[0] = id;
    
    
SQL_ThreadQuery(g_hTuple"QueryLoadRank"querydatasizeof(data));
    return 
PLUGIN_HANDLED;
}

public 
QueryLoadRank(failstateHandle:hQueryerror[], errnumdata[], sizeFloat:queuetime)
{
    if( 
failstate == TQUERY_CONNECT_FAILED
    
|| failstate == TQUERY_QUERY_FAILED )
    {
        
set_fail_state(error);
    }
    else
    {
        new 
id data];
        
        if(
SQL_NumResults(hQuery))
        {
            new 
colRank SQL_ReadResult(hQuery0) + 1;
            
client_printcolor(id"/y[/ctr%s/y] Your points /ctr%d"PREFIXcolRank);
        }
    }

Extra stuff in the script.
PHP Code:
    pKills[id] = 0;
    
pDeaths[id] = 0;
    
pHeadshots[id] = 0;
    
pPoints[id] = 0
////////////////////////////////////////////////////////////////////////////////////////////////////////

I have tryed following. But it prints out wrong number, that numbers doesnt exist in database so what am i doing wrong and how to fix it?

PHP Code:
    formatex(querycharsmax(query), "SELECT COUNT(*) FROM player_player WHERE points > '%d'"pKills[id]); 

Last edited by 4ever16; 06-04-2018 at 14:41.
4ever16 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 04:42.


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