display all records from a database table in gui
#9

Quote:
Originally Posted by Lolcio12
Посмотреть сообщение
So this should be done in this way? :

Код:
new item[MAX_PLAYERS][99], SOMECOUNT;
OnPlayerCommandText:
Код:
	if(!strcmp(cmdtext,"/cmd",true))
	{
		item[playerid] = 0;
		mysql_query("SELECT item FROM table");
		mysql_store_result();
		while(mysql_retrieve_row())
		{
		        mysql_fetch_field_row(resultstr,"item");
			result=strval(resultstr);

			format(str,sizeof(str),"id: %d\n",result);
			strcat(guistr,str);
			
                        SOMECOUNT++;
			item[playerid][SOMECOUNT]=result;
		}
		mysql_free_result();
		ShowPlayerDialog(playerid,666,DIALOG_STYLE_LIST,"items",guistr,"ok","");
		return 1;
	}
OnDialogResponse:
Код:
	if(dialogid == 666)
	{
		printf("clicked id: %d",item[playerid][listitem]);
		return 1;
	}
this is realy gonna work cuz i also work on such things in similar ways , also i dont know exactly about the sequcne of dialog list atm

but
Quote:

That's perhaps a bit faster than my solution (perhaps, maybe, maybe not), but wastes a lot more space. Space that does not necessarily need wasting

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)