29.07.2014, 13:15
Hello everyone,
I would like to load data via MySQL.
When the ID is in the order (0, 1, 2, etc) the script works fine, but when I delete the entries (0,2,6,7) script bug
Here is my script:
I'm stuck on this problem from two days.
Thank you in advance to whoever can help me
I would like to load data via MySQL.
When the ID is in the order (0, 1, 2, etc) the script works fine, but when I delete the entries (0,2,6,7) script bug

Here is my script:
Код:
public LoadPockets()
{
new fields[61][40], row[150], row2[150];
new Pockets_Count;
new query[128];
format(query, sizeof(query), "SELECT COUNT(*) FROM server_pockets");
mysql_query(query);
mysql_store_result();
mysql_fetch_row(row2);
Pockets_Count = strval(row2);
if(!mysql_num_rows()) { mysql_free_result(); return; }
for(new i=1; i <= Pockets_Count; i++)
{
format(query, sizeof(query), "SELECT * FROM server_pockets WHERE id = %d", i);
mysql_query(query);
mysql_store_result();
mysql_fetch_row(row);
split(row, fields, '|');
PocketInfos[i][ID] = strval(fields[0]);
PocketInfos[i][OBJECTID] = strval(fields[1]);
PocketInfos[i][CHARACTER] = strval(fields[2]);
TotalPockets++;
mysql_free_result();
}
mysql_free_result();
}
Thank you in advance to whoever can help me

