Raised This Month: $51 Target: $400
 12% 

Solved Query not fetching


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pride95
Senior Member
Join Date: Aug 2015
Old 03-27-2018 , 15:37   Query not fetching
Reply With Quote #1

PHP Code:

public Action Event_PlayerConnect(Event event, const char[] namebool dontBroadcast)
{
int Id event.GetInt("userid");
int Client GetClientOfUserId(Id);

if(
Client != 0)
{
IntRank[Client] = 0;
IntHeadshots[Client] = 0;
IntKills[Client] = 0;
IntDeaths[Client] = 0;

int Steam GetSteamAccountID(Client);

if(
Steam != 0)
{
char Query[256];
FormatEx(Querysizeof(Query), "SELECT count(*), s2.Total, s2.kills, s2.deaths, s2.hs FROM (SELECT steamid, name, sum(score) Total FROM rank_table GROUP BY steamid) s join (SELECT steamid, name, sum(score) Total, kills, deaths, hs FROM rank_table GROUP BY steamid) s2 ON s2.steamid = %d AND (s.Total > s2.Total OR s.Total = s2.Total AND s.name <= s2.name);"Steam);
DatabaseDB.Query(functionSQLRankQueryIdDBPrio_Normal);
}
}
}

public 
void functionSQLRank(Database dbDBResultSet rs, const char[] errorany data)
{
if(
rs == null)
{
LogError("(functionSQLRank) %s"error);
}
else
{
int Client GetClientOfUserId(data);

if(
Client != 0)
{
if(
rs.FetchRow())
{
IntRank[Client] = rs.FetchInt(0);
IntScore[Client] = rs.FetchInt(1);
int Kills rs.FetchInt(2);
int Deaths rs.FetchInt(3);
int Headshots rs.FetchInt(4);
FloatKPD[Client] = GetKPD(KillsDeaths);
IntPercent[Client] = GetHeadshotPercent(HeadshotsKills);
}
}
}

for steamid: 80995191
0 rank, 0 score etc

in my table 80995191 has 23 rank, 23 score etc.

in phpmyadmin the query works fine, but in sourcemod all entries are 0, why?

Last edited by DarkDeviL; 03-27-2018 at 19:49. Reason: Restored post
pride95 is offline
Reply



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 18:46.


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