Raised This Month: $ Target: $400
 0% 

Problem with Varchars


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Schwabba
Senior Member
Join Date: Apr 2008
Old 10-16-2010 , 03:38   Problem with Varchars
Reply With Quote #1

PHP Code:
public Toplist(id)
{
    for(new 
igMaxClientsi++)
    {
        if(
is_user_connected(i))
        {
            
Save_MySql(i// Save all stats to get the correct rank
        
}
    }

    new 
Data[1]
    
Data[0] = id

    
new szTemp[512]

    for(new 
i16i++)
    {
        new 
up -1
        format
(szTemp,charsmax(szTemp),"SELECT * FROM `deathrun` ORDER BY `deathrun`.`points` DESC LIMIT %i , %i"upi)
        
SQL_ThreadQuery(g_SqlTuple,"Toplist2",szTemp,Data,1)
    }

    return 
PLUGIN_CONTINUE
}

public 
Toplist2(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    if(
FailState == TQUERY_CONNECT_FAILED)
    {
        
log_amx("Load - Could not connect to SQL database.  [%d] %s"ErrcodeError)
    }
    else if(
FailState == TQUERY_QUERY_FAILED)
    {
        
log_amx("Load Query failed. [%d] %s"ErrcodeError)
    }

    if(
SQL_ReadResult(Query,0) || SQL_ReadResult(Query,0) == 0)
    {

        new 
countcount1count2count3count4count5

        count 
SQL_ReadResult(Query,0)
        
count1 SQL_ReadResult(Query,1)
        
count2 SQL_ReadResult(Query,2)
        
count3 SQL_ReadResult(Query,3)
        
count4 SQL_ReadResult(Query,4)
        
count5 SQL_ReadResult(Query,5)

        if(
count == 0)
        
count 1

        print_color
(010"^x04-=[Pingstars]=- ^x01 %s - %s - %i - %i - %i - %i "countcount1count2count3count4count5)
    }

    return 
PLUGIN_HANDLED

returns

-=[Pingstars]=- - - 951 - 39 - 125 - 1
-=[Pingstars]=- - - 0 - 0 - 0 - 0

mysql entries:

steamid name points lives frags
STEAM_0:0:16065469 Pingstars * Schwabba 951 39 125 1
BOT [P*D]Bruce_Lee (99) 0 0 0 0

can't get the varchars.. dunno why..

when i change

PHP Code:
if(SQL_ReadResult(Query,0) || SQL_ReadResult(Query,0) == 0
to

PHP Code:
if(SQL_ReadResult(Query,0)) 
then i get no results
Schwabba 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 10:17.


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