not send the query in ongamemodeinit - 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: not send the query in ongamemodeinit (
/showthread.php?tid=608042)
not send the query in ongamemodeinit -
mcreed - 26.05.2016
hi, friends.
i have a problem, the problem is I am sending a query, but this is not sent.
pawn Код:
mysql_query(MySQL,"SELECT * FROM svr_rangos");
new cont_dat;
while(cont_dat < cache_num_rows())
{
infRango[cont_dat][ID] = cache_get_field_content_int(cont_dat,"rangID");
infRango[cont_dat][Propiedad] = cache_get_field_content_int(cont_dat,"rangPropiedad");
cache_get_field_content(cont_dat,"rangNom_ES",infRango[cont_dat][NombreES]);
cache_get_field_content(cont_dat,"rangNom_ING",infRango[cont_dat][NombreING]);
infRango[cont_dat][MinEXP] = cache_get_field_content_int(cont_dat,"rangExp_min");
cont_dat++;
}
cant_Rangos=cont_dat;
new query[64];
cache_get_query_string(query);
printf("Executed query: \"%s\"", query);
printf("Rangos Totales: %d",cant_Rangos);
result from cache_get_query_string is ""
Respuesta: not send the query in ongamemodeinit -
mcreed - 27.05.2016
Solved, the problem was that sent the query before connecting to the database.
Re: not send the query in ongamemodeinit -
Konstantinos - 27.05.2016
You're going to have problems with memory leaks because you never delete the result (which you never store in the first place).
Other than that, I want to say 2 more things. You keep calling cache_num_rows for each iteration, store it to a variable to avoid that and use threaded queries.