Get information from a Table Mysql
#1

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.
Reply
#2

Somebody?
Reply
#3

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.
Reply
#4

Ok, i will try it, apreciate.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)