SA-MP Forums Archive
Mysql Problem - 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: Mysql Problem (/showthread.php?tid=487827)



Mysql Problem - Marc_Johnson - 15.01.2014

hello, I am converting my server from Dini to MYSQL and i use the plugin of StrickenKid...
and this is my Query for loading data.

Код:
public OnPlayerLogin(playerid,password[])
{
	    new string[300];
	    format(string, sizeof(string), "SELECT * FROM `utenti` WHERE (`Nick` = '%s' AND `Password` = '%s')", PlayerName(playerid), password);
		mysql_query(string);
		mysql_store_result();
		if(mysql_num_rows() != 0)
		{
			while(mysql_fetch_row(string, "|"))
			{
     				sscanf(string, "p<|>dddddddddddddddddddd",
	 				PlayerInfo[playerid][pLevel],
		 			PlayerInfo[playerid][pAdmin],
		 			PlayerInfo[playerid][pLottoNr],
		 			PlayerInfo[playerid][pPAntidolorifica],
		 			PlayerInfo[playerid][pPAntidroga],
		 			PlayerInfo[playerid][pPRigenerazione],
		 			PlayerInfo[playerid][pDonateRank],
		 			PlayerInfo[playerid][pRegistered],
		 			PlayerInfo[playerid][pSex],
		 			PlayerInfo[playerid][pInvWeapon],
 					PlayerInfo[playerid][pInvAmmo],
		 			PlayerInfo[playerid][pOrologio],
		 			PlayerInfo[playerid][pZaino],
		 			PlayerInfo[playerid][pCorde],
	 				PlayerInfo[playerid][pWalkietalkie],
		 			PlayerInfo[playerid][pBenda],
		 			PlayerInfo[playerid][pTrafficoCell],
		 			PlayerInfo[playerid][pSigarette],
		 			PlayerInfo[playerid][pAccendino],
		 			PlayerInfo[playerid][pMaschera]);
		 			
			}
			mysql_free_result();
		}
}
the problem is that the sscanf string load 23 variables at one time and I need to load 139 variables! how can I do?


Re: Mysql Problem - Quis - 15.01.2014

You fetching data to "string" which has size of only 300 cells. Try more, like 512 or 1024. If it isn't enough, you can try make two or more queries.


Re: Mysql Problem - Marc_Johnson - 15.01.2014

@Quis thx!