SA-MP Forums Archive
Get information from a Table Mysql - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Get information from a Table Mysql (/showthread.php?tid=583530)



Get information from a Table Mysql - WaZP - 28.07.2015

Hello everyone !

It's possible to write whatever you want in a Mysql Table, and after to see that text in game by a command?

I was searched a lot, but i don't found.

I apreciate, if somebody give me an example.

I tried to make it, but i don't known if it works.
Код:
        CMD:news(playerid,params[])
	{
		new query[MAX_STRING], userstring[MAX_STRING];
		new date, title;
		format(query, sizeof(query), "SELECT * FROM News ORDER DESC");
		mysql_query(query);
		mysql_store_result();
		while(mysql_fetch_row(query))
		{
			format(userstring, sizeof(userstring), "%s \n",userstring);
		}
		mysql_free_result();
		ShowPlayerDialog(playerid,DIALOG_DEALERSHIP,DIALOG_STYLE_LIST,"News",userstring,"Read","Close");
Thankx a lot, and sorry for my bad Writing.


Re: Get information from a Table Mysql - WaZP - 30.07.2015

Somebody?


Re: Get information from a Table Mysql - BleverCastard - 30.07.2015

It is.

PHP код:
CMD:news(playerid,params[])
    {
        new 
query[MAX_STRING], userstring[MAX_STRING];
        
format(querysizeof(query), "SELECT * FROM News ORDER DESC");
        
mysql_query(query);
        
mysql_store_result();
        while(
mysql_fetch_row(query))
        {
            
format(userstringsizeof(userstring), "%s \n",userstring);
ShowPlayerDialog(playerid,DIALOG_DEALERSHIP,DIALOG_STYLE_LIST,"News",userstring,"Read","Close");
        }
        
ShowPlayerDialog(playerid,DIALOG_DEALERSHIP,DIALOG_STYLE_LIST,"News",userstring,"Read","Close"); 
I think. Haven't scripted in a while.


Re: Get information from a Table Mysql - WaZP - 31.07.2015

Ok, i will try it, apreciate.