mysql records - 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 records (
/showthread.php?tid=656261)
mysql records -
Oficer - 11.07.2018
Hi, I have in my database 3 records and I save this into enum > Company[Name]...
And I don't know, how I can show all records, because when I save - cache_get_value_name(0, "Name", Company[Name], 30);
In this enum I have only first record, how I can load all records?
Re: mysql records -
Florin48 - 11.07.2018
post the code
Re: mysql records -
Oficer - 11.07.2018
PHP код:
new query[128];
mysql_format(DB, query, sizeof(query), "SELECT * FROM `Test`");
mysql_query(DB, query);
cache_get_value_name(0, "Name", Company[Name], 30);
cache_get_value_name(0, "Location", Company[Location], 30);
cache_get_value_int(0, "Cash", Company[Cash]);
I using this in dialog, because I wont show all company from database
It's save only first record from database :/
Re: mysql records -
Florin48 - 11.07.2018
PHP код:
new Cache:result = mysql_query(DB, "SELECT * FROM `Test`");
for(new i, j = cache_num_rows(); i != j; ++i)
{
cache_get_value_name(i, "Name", Company[Name], 30);
cache_get_value_name(i, "Location", Company[Location], 30);
cache_get_value_int(i, "Cash", Company[Cash]);
}
that should help you.
Re: mysql records -
Oficer - 11.07.2018
Thanks Bro!! <333