This is the error
PHP Code:
Load Query failed. [1] near "(": syntax error
I've searched for what might have caused the error and tried everything that could be tried, but in vain.
This is what I currently have in the script:
PHP Code:
new szData[1]; szData[0] = iPlayer
new szTemp[512]
...
else if(equali(cMessage, "/rank") || equali(cMessage, "rank"))
{
format(szTemp, charsmax(szTemp),
"
WITH rankedPlayers AS (
SELECT
steamid,
name,
score,
points,
infections,
kills,
deaths,
RANK() OVER (ORDER BY score DESC) AS rank,
(SELECT COUNT(*) FROM %s) AS total_players
FROM
%s
)
SELECT
steamid,
name,
score,
rank,
total_players,
points,
infections,
kills,
deaths
FROM
rankedPlayers
WHERE
steamid = '%s';
",
TABEL, TABEL, g_cSteam[iPlayer]
);
SQL_ThreadQuery(g_SqlTuple, "ZP_RANK", szTemp, szData, 1)
return 1
PHP Code:
public ZP_RANK(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
{
if(FailState == TQUERY_CONNECT_FAILED)
log_amx("Load - Could not connect to SQL database. [%d] %s", Errcode, Error)
else if(FailState == TQUERY_QUERY_FAILED)
log_amx("Load Query failed. [%d] %s", Errcode, Error)
new id; id = Data[0]
if(!is_user_connected(id))
return
if(SQL_NumResults(Query))
{
new score = SQL_ReadResult(Query, 2)
new rank = SQL_ReadResult(Query, 3)
new total = SQL_ReadResult(Query, 4)
new points = SQL_ReadResult(Query, 5)
new infections = SQL_ReadResult(Query, 6)
new kills = SQL_ReadResult(Query, 7)
new deaths = SQL_ReadResult(Query, 8)
PrintToChat(id, "^x04[ZP] ^x01 Your rank is %i/%i with a score of %i >> %i kills %i deaths, %i infections and %i points.", \
rank, total, score, kills, deaths, infections, points)
}
else PrintToChat(id, "^x04[ZP] You don't have any rank !")
}
Its saying "You don't have any rank" for everyone