SA-MP Forums Archive
MySQL Help - 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 Help (/showthread.php?tid=329985)



MySQL Help - mikiii18 - 31.03.2012

Код:
new idx = 0;
	new fsalario;
	new frank;
	new savingstring[20];
	printf("DynamicFactionsSalario - Teste????");
	while (idx < 11)
	{
		new sql[128];
                printf("DynamicFactionsSalario - Teste????");
		format(sql, sizeof(sql), "SELECT * FROM `factionsalario` WHERE 'factionid'='%d'",idx);
		mysql_query(sql);
		mysql_store_result();
		while(mysql_retrieve_row())
		{
        	mysql_fetch_field_row(savingstring, "salario"); fsalario=strval(savingstring);
        	mysql_fetch_field_row(savingstring, "rank"); frank=strval(savingstring);
        	DynamicFactionsSalario[idx][frank]=fsalario;
        	printf("DynamicFactionsSalario[%d][%d]=%d;",idx,frank,fsalario);
		}
    	mysql_free_result();
    	idx=idx+1;
	}
Well, I've been testing it, and the script that is inside of "while(mysql_retrieve_row())" doesn't load.. Why "while(mysql_retrieve_row())" doesn't work?


Re: MySQL Help - mikiii18 - 31.03.2012

Found the problem.

In "WHERE 'factionid'='%d'", I must use "WHERE 'factionid'=%d"