Help mysql command, thanks , i rep you ! [REP ++] -
buburuzu19 - 07.11.2014
I am using mysql r39-2 and i am getting errors at this command.
pawn Код:
CMD:cmembers(playerid, params[])
{
if(playerVariables[playerid][pClan] >= 1 && playerVariables[playerid][pClanRank] >= 1)
{
new aim[1000];
format(aim, 256,"{FFB300}%s members:{FFFFFF} \n",clanVariables[playerVariables[playerid][pClan]][cClanName]);
new query[300],test[300];
format(query, sizeof(query), "SELECT playerName, playerClanRank FROM playeraccounts WHERE playerClan = %d ORDER BY playerClanRank DESC LIMIT 50",playerVariables[playerid][pClan]);
mysql_query(query);
format(test, sizeof(test), "SELECT playerClanRank FROM playeraccounts WHERE playerClan = %d",playerVariables[playerid][pClan]);
mysql_query(test);
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_fetch_field_row(query, "playerName");
mysql_fetch_field_row(test, "playerClanRank");
format(aim, sizeof(aim), "%s %s - Rank: %s \n", aim, query, test);
}
mysql_free_result();
ShowPlayerDialog(playerid,DIALOG_CMEMBERS,DIALOG_STYLE_LIST,"Members in clan",aim,"Go","Cancel");
}
}
pawn Код:
F:x(30123) : error 035: argument type mismatch (argument 1)
F:x30125) : error 035: argument type mismatch (argument 1)
Fx(30126) : error 017: undefined symbol "mysql_store_result"
F:x(30127) : error 017: undefined symbol "mysql_retrieve_row"
F:x(30129) : error 017: undefined symbol "mysql_fetch_field_row"
F:x(30130) : error 017: undefined symbol "mysql_fetch_field_row"
F:x(30133) : error 017: undefined symbol "mysql_free_result"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
7 Errors.
Re: Help mysql command, thanks , i rep you ! [REP ++] -
sammp - 07.11.2014
MySQL R39-2 doesn't use that method of querying anymore, hell that method was abandoned at R7.
Look up the syntax before you just randomly upgrade your MySQL 32 versions.
Re: Help mysql command, thanks , i rep you ! [REP ++] -
buburuzu19 - 08.11.2014
I am converting my gm to r39-2 and i am stuvked on this command.
Re: Help mysql command, thanks , i rep you ! [REP ++] -
Mic_H - 08.11.2014
https://sampwiki.blast.hk/wiki/MySQL/R33
https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_query
conhandle is the number returned when you connect to your database..
new MySQL_ConHand = mysql_connect(blabla.... blabla);
mysql_query(MySQL_ConHand, query);
Re: Help mysql command, thanks , i rep you ! [REP ++] -
sammp - 08.11.2014
Make an SQL handle.
pawn Код:
new sqlHandle = mysql_connect(host, user, db, password);
From there, check if it is connected.
pawn Код:
if(mysql_errno() != 0) { print("connection failed"); }
Then, you're ready to run a query:
pawn Код:
new query[128];
mysql_format(sqlHandle, query, sizeof(query), "SELECT * FROM `table` WHERE `condition` = '%s'", condition);
mysql_tquery(sqlHandle, query, "MySQLCallBack", "d", playerid); // "d", playerid are both optional params