while in mysql
#1

Код:
stock UnreadMessages(playerid)
{
    new query[256], pname[MAX_PLAYER_NAME], string[256];
	GetPlayerName(playerid, pname, sizeof(pname));
    format(query, sizeof(query), "SELECT Sender, Message, id FROM `messages` WHERE `Receiver` = '%s' AND `Read` ='0'", pname);
	mysql_query(query);
	mysql_store_result();
 	while(mysql_num_rows())
	{
     	mysql_fetch_row(string);
	    new message[256], sender[MAX_PLAYER_NAME], id;
		sscanf(string, "p<|>s[24]s[256]d", sender, message, id);
		str_replace(sender, '_', ' ');
		format(string, sizeof(string), ""COL_ORANGE"[O-PM] from %s:"COL_YELLOW" %s", sender, message);
		SendSplitMessage(playerid, -1, string);
		format(query, sizeof(query), "UPDATE `messages` SET `Read` = '1' WHERE id = '%d'", id);
		mysql_query(query);
		mysql_free_result();
	}
	return 1;
}
Why this code sends only 1 message?
Reply


Messages In This Thread
while in mysql - by Yako - 03.02.2014, 12:21
AW: while in mysql - by selEcT - 03.02.2014, 14:26

Forum Jump:


Users browsing this thread: 1 Guest(s)