SA-MP Forums Archive
Array initialization via 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: Array initialization via mysql (/showthread.php?tid=619367)



Array initialization via mysql - godless_phoenix - 16.10.2016

Код:
enum{a,b[100]}
new myarr[100000][enum];
mysql_tquery(select myarr,"callback");
callback(){
 loop(i<100000){
  a[i][b]=cache_get_value_index_int(i,a);
  mysql_tquery(select myarr_bdata),"callback2",ai,i);
 }
}
callback2(ai){
 loop(j<100){
 a[ai][b][j]=cache_get_value_index_int(a); 
 }
}

sql myarr table: a; (100.000 rows = 100.000 different a)
sql myarr_bdata table a, b (a is foreign key, 100.000x100=10.000.000 rows, each 100 connected with an table.a)
This is an gamemodeinit action but;
That way is not a logical way i believe,
so How can i make it right?
I was thinking to mysql "group by" and join. But i wasnt successful about it