[HELP] How show data of table sql in server?
#1

I tried but it went wrong. if someone can help me, thank you!

Example, i have a list of admins in my db, and i want show in the server on /listadmins
Reply
#2

Are you sure to know how to use MySQL ? (or just SQL, it's the BASICS of the language)

Use a SELECT query, use cache_num_rows as a maximum to your for loop then display the player names you would have gotten from the SELECT query using cache_get_field_content or cache_get_row using your loop variable as row index.
Reply
#3

So. Firstly thank you for being here.
Well, sorry, MySQL
in my attempts the most I could get was, showing the amount of admins who was in the table. The name, with level etc.. not returned. did not show. i used SendClientMessage, Printf to show but, dont works..

sorry my english
Reply
#4

Your english is good enough to be understood.

Try this way

PHP код:

// In your command
mysql_tquery(yourHandle"SELECT `name`, `admin` FROM `Players` WHERE `admin` >= 1""OnAdminsFound_""i"playerid); // here, playerid = the id of the player who has launched the command

// At the bottom of your script

forward OnAdminsFound_(playerid);
public 
OnAdminsFound_(playerid)
{
      new 
name[MAX_PLAYER_NAME+1], rankstring[145];
      for(new 
0cache_num_rows(); i++)
      {
            
cache_get_row(00name);
            
rank cache_get_row_int(01);
            
format(stringsizeof(string), "Admin name : %s | Admin level : %d"namerank);
            
SendClientMessage(playerid, -1string);
      }
      return 
1;

Reply
#5

I got it! now worked

Thank you so much!

++REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)