MySQL listing all rows in a dialog
#1

Hey there,

i wanted to know how to list all rows in a table and show it into a dialog. Like showing all the clans in a dialog from a table. I just want a piece of code on how to do it.

- Thanks in advance!
Reply
#2

You did not mention what version of mysql you are using. This "piece of code" is for the latest versions:
PHP код:
// in a command to list all clans or whatever you want
mysql_tquery(handle_here"query_here""callback_here""i"playerid);
forward callback_here(playerid);
public 
callback_here(playerid)
{
    new 
rows cache_get_row_count();
    if (!
rows) return ... // error no clans
    
    
new info[256]; // change the size to hold the whole text
    
for (new i!= rowsi++)
    {
        
// retrieve the data.. use "i" as rowid
        
        
format(infosizeof info"%s format_here"info, ...);
    }
    
ShowPlayerDialog(...);
    return 
1;

Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You did not mention what version of mysql you are using. This "piece of code" is for the latest versions:
PHP код:
// in a command to list all clans or whatever you want
mysql_tquery(handle_here"query_here""callback_here""i"playerid);
forward callback_here(playerid);
public 
callback_here(playerid)
{
    new 
rows cache_get_row_count();
    if (!
rows) return ... // error no clans
    
    
new info[256]; // change the size to hold the whole text
    
for (new i!= rowsi++)
    {
        
// retrieve the data.. use "i" as rowid
        
        
format(infosizeof info"%s format_here"info, ...);
    }
    
ShowPlayerDialog(...);
    return 
1;

Thank you, sir. By the way, i'm using the R39

EDIT: The code will list all clans and their names right?
Reply
#4

Yes as he said
PHP код:
// retrieve the data.. use "i" as rowid 
And you will get everything
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)