02.03.2015, 07:27
For Example if we have MySQL Table with fields: id and nick we can use the next code to get nick:
And We have also:
My question is: what will be faster, MySQL query on localhost or for loop? For small tabs it for loop will be faster, but what, if we will have 2000 elements?
Code:
new query[64]; mysql_format(MySQLHandler, query, sizeof(query), "SELECT `nick` FROM `TableTest` WHERE `id`=%d", testValue); mysql_pquery(MySQLHandler, query, "funTest"); [...] forward funTest(); public funTest() { new a[32]; cache_get_row(0, 0, a); print(a); return 1; }
Code:
for(new i; i < MAX; i++)//MAX is integer const { if(i == testValue)//testValue is a variable that we can change, it is only example, above also print(tab[i];//tab is table of nicks }