SA-MP Forums Archive
How to load multiple rows in mysql - 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: How to load multiple rows in mysql (/showthread.php?tid=558856)



How to load multiple rows in mysql - zaibaslr2 - 19.01.2015

Hello.
I want to get mysql data from multiple rows, for example:
I need to get all rows that contains SklypoID = 2 and then save fields to variables.

How should I do that?
I'm using https://sampforum.blast.hk/showthread.php?tid=429464 mysql plugin.
Thanks


Re: How to load multiple rows in mysql - ball - 19.01.2015

I can't work with this plugin, but I can do it with StrickenKid's plugin

Код:
new s[100];

mysql_query("SELECT * from yourTable where SklypoID = 2");
mysql_store_result();

while(mysql_fetch_row(s, " "))
{
	//here use sscanf or mysql function to get data
}
mysql_free_result();



Re: How to load multiple rows in mysql - zaibaslr2 - 19.01.2015

Thanks for your answer, will try when I get home


Re: How to load multiple rows in mysql - zaibaslr2 - 23.01.2015

Quote:
Originally Posted by ball
Посмотреть сообщение
I can't work with this plugin, but I can do it with StrickenKid's plugin

Код:
new s[100];

mysql_query("SELECT * from yourTable where SklypoID = 2");
mysql_store_result();

while(mysql_fetch_row(s, " "))
{
	//here use sscanf or mysql function to get data
}
mysql_free_result();
My plugin uses this:
Код:
sql_fetch_row(Result:result, sep[], dest[], dest_len = sizeof(dest));
How should I do it then? Thanks