[/email] CMD reading from mysql with DIALOG
#1

Код:
CMD:email(playerid,params[])
{
	if(IsPlayerConnected(playerid))
	{
		new string[10000],stringg[1000];
		new text[75];
		mysql_format(SQL, stringg, sizeof(stringg), "SELECT * FROM email WHERE playerid = %d ORDER BY id DESC",PlayerInfo[playerid][pSQLID]);
		new Cache: result12 = mysql_query (SQL, stringg);
		for ( new i, j = cache_get_row_count ( ); i != j; ++i )
		{
			cache_get_field_content(i, "text", text);
            format(string, sizeof(string), "%s\n%s", string,text);
		}
		cache_delete(result12);
		ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "Emails", string, "OK", "Close");
		
		new var[ 140 ];
		mysql_format(SQL, var, sizeof(var), "UPDATE `users` SET newemail = 0 WHERE id = %d", PlayerInfo[playerid][pSQLID]);
		mysql_query(SQL ,var);
	}
}
Can someone tell me what is wrong with this command ?
No error after compiling with pawno
Reply
#2

You tell use. What exactly does not work?

Plus, bit of advice. Use threaded queries when you can. There is almost never a need to use unthreaded queries. Point two, add a boolean column "hasRead" to your e-mail table instead of storing the count in another unrelated table. You can use "select count(*) from email where playerid = %d and not hasRead" to retrieve the number of unread emails.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)