#1

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 ?
PHP код:
CMD:factions(playeridparams[])
{
    new 
string[500];
    new 
DBResultResult 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"Field50);
            
db_get_field_assoc(Result"ID"Field230);
            
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;

^^ This is of sqlite. I'm making a similar command to this but in mysql.
PHP код:
CMD:fmembers(playeridparams[])
{
    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(Mysqlquery);
    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
    
}

This is what im doing im stuck at while statement that what should i do to retrieve the next row's data
Reply
#2

EDIT: Fixed i used a loop for all the columns
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)