Originally Posted by Logic_
There are tons of mistakes in your code!
Why are you adding +1 to the loop ID? The arrays start from 0 not 1 and you should.
PHP код:
HouseInfo[i+1][HouseID]);
Remove the if statement in the loop. That clearly doesn't makes sense if your house row IDs have auto increment.
SQL is a relational database, make use of foreign keys. Make a separate table dedicated to house weapons!
PHP код:
cache_get_value_int(i, "Weapons0", HouseInfo[i+1][HouseWeapons][0]);
cache_get_value_int(i, "Weapons1", HouseInfo[i+1][HouseWeapons][1]);
cache_get_value_int(i, "Weapons2", HouseInfo[i+1][HouseWeapons][2]);
cache_get_value_int(i, "Weapons3", HouseInfo[i+1][HouseWeapons][3]);
cache_get_value_int(i, "Weapons4", HouseInfo[i+1][HouseWeapons][4]);
cache_get_value_int(i, "Weapons5", HouseInfo[i+1][HouseWeapons][5]);
cache_get_value_int(i, "Weapons6", HouseInfo[i+1][HouseWeapons][6]);
cache_get_value_int(i, "Weapons7", HouseInfo[i+1][HouseWeapons][7]);
cache_get_value_int(i, "Weapons8", HouseInfo[i+1][HouseWeapons][8]);
cache_get_value_int(i, "Weapons9", HouseInfo[i+1][HouseWeapons][9]);
cache_get_value_int(i, "Weapons10", HouseInfo[i+1][HouseWeapons][10]);
cache_get_value_int(i, "Weapons11", HouseInfo[i+1][HouseWeapons][11]);
cache_get_value_int(i, "Weapons12", HouseInfo[i+1][HouseWeapons][12]);
cache_get_value_int(i, "Weapons13", HouseInfo[i+1][HouseWeapons][13]);
cache_get_value_int(i, "Weapons14", HouseInfo[i+1][HouseWeapons][14]);
cache_get_value_int(i, "Weapons15", HouseInfo[i+1][HouseWeapons][15]);
cache_get_value_int(i, "Weapons16", HouseInfo[i+1][HouseWeapons][16]);
cache_get_value_int(i, "Weapons17", HouseInfo[i+1][HouseWeapons][17]);
cache_get_value_int(i, "Weapons18", HouseInfo[i+1][HouseWeapons][18]);
cache_get_value_int(i, "Weapons19", HouseInfo[i+1][HouseWeapons][19]);
cache_get_value_int(i, "Weapons20", HouseInfo[i+1][HouseWeapons][20]);
(( Ewww, Yuck! ))
Just run this query separately once you've loaded all the houses!
PHP код:
new query[128];
mysql_format(g_SQL, query, sizeof query, "SELECT * FROM furniture WHERE HouseID = %d", HouseInfo[i+1][HouseID]);
mysql_tquery(g_SQL, query, "OnLoadFurniture", "d", i);
becomes
PHP код:
mysql_tquery(g_SQL, "SELECT * FROM furniture", "OnLoadFurnitures");
|