display all records from a database table in gui
#1

Hi, I would like to do something like that after entering the command displays a list of the gui and prints all records in the table, and when you click a result of a specific action is performed.

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);
			
			item[playerid]++;
		}
		mysql_free_result();
		ShowPlayerDialog(playerid,666,DIALOG_STYLE_LIST,"items",guistr,"ok","");
		return 1;
	}
OnDialogResponse:
Код:
	if(dialogid == 666)
	{
		if(listitem == item[playerid])
		{
			printf("clicked id: %d",item[playerid]);
		}
		return 1;
	}
This unfortunately does not work and I have no idea how it could have been done differently. Please help me.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)