27.02.2018, 12:08
I'm not that pro with using MySQL, but i figured out how to select stuffs on table (that i might selected it somehow wrong)
that's the code, i want to show 10 players showing respects.
Errors:
Line 3927:
Photo of my MySQL table:
Using MySQL plugin R41-2.
that's the code, i want to show 10 players showing respects.
PHP код:
CMD:top(playerid)
{
mysql_query(connection, "SELECT * `RESPECT` FROM `players` WHERE `RESPECT` > 0 ORDER BY `RESPECT` DESC LIMIT 0, 10", true);
new gString[256], name[MAX_PLAYER_NAME];
new rows = cache_num_rows();
if (rows)
{
for (new i = 0; i < rows; i ++)
{
cache_get_value(i, "USERNAME", pInfo[playerid][Name], MAX_PLAYER_NAME);
cache_get_value_int(i, "RESPECT", pInfo[playerid][Respect]);
format(gString, sizeof(gString), "%s%s %d Respect\n", gString, name, pInfo[playerid][Respect]);
}
ShowPlayerDialog(playerid, DIALOG_TOP, DIALOG_STYLE_LIST, "Top Respect", gString, "Ok", "");
}
return 1;
}
PHP код:
C:\Users\Wallen\Desktop\LS DM\gamemodes\DBv1.pwn(3927) : error 017: undefined symbol "connection"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
PHP код:
mysql_query(connection, "SELECT * `RESPECT` FROM `players` WHERE `RESPECT` > 0 ORDER BY `RESPECT` DESC LIMIT 0, 10", true);
Using MySQL plugin R41-2.