12.12.2016, 04:17
How to retrieve the next row's data? I'm using mysql r39-6 Like for sqlite its db_next_row(Result) and for mysql ?
^^ This is of sqlite. I'm making a similar command to this but in mysql.
This is what im doing im stuck at while statement that what should i do to retrieve the next row's data
PHP код:
CMD:factions(playerid, params[])
{
new string[500];
new DBResult: Result = db_query(Database, "SELECT `ID`, `Name` FROM `Faction`");
if (db_num_rows(Result))
{
new Field[300],Field2[30];
do
{
db_get_field_assoc(Result, "Name", Field, 50);
db_get_field_assoc(Result, "ID", Field2, 30);
format(string,sizeof(string),"%s\n%d. %s",string,strval(Field2),Field);
}
while (db_next_row(Result));
}
db_free_result(Result);
ShowPlayerDialog(playerid,FDIALOG+99,DIALOG_STYLE_LIST,"Factions - U:CnR",string,"Okay","");
return 1;
}
PHP код:
CMD:fmembers(playerid, params[])
{
if(pInfo[playerid][facno] == 0) return SCM(playerid,-1,"You are not authorised to use this command");
new query[300];
mysql_format(Mysql,query,sizeof(query),"SELECT `Name` FROM `users` WHERE `FacNo` = '%d'",pInfo[playerid][facno]);
new Cache:result = mysql_query(Mysql, query);
if(cache_num_rows(result))
{
new Field[300],string[500];
do
{
cache_get_field_content(0,"Name",Field,Mysql,24);
format(string,sizeof(string),"%s\n%s",string,Field);
}
while(d
}
}