stock LoadHouses() {
new rows;
format(query, sizeof(query), "SELECT * FROM houses");
mysql_query(query);
mysql_store_result();
rows = mysql_num_rows();
mysql_free_result();
for(new i = 1; i < rows; i++) {
new fquery[200];
format(fquery, sizeof(fquery), "SELECT * FROM houses WHERE id = %i", i);
mysql_query(fquery);
mysql_store_result();
new savingstring[64];
while(mysql_fetch_row_format(fquery, "|"))
{
mysql_fetch_field_row(House[i][hName], "housename");
mysql_fetch_field_row(House[i][hOwner], "houseowner");
mysql_fetch_field_row(savingstring, "posx"); House[i][hPosX] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "posy"); House[i][hPosY] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "posz"); House[i][hPosZ] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "buyprice"); House[i][hBuyPrice] = strval(savingstring);
mysql_fetch_field_row(savingstring, "sellprice"); House[i][hSellPrice] = strval(savingstring);
mysql_fetch_field_row(savingstring, "slots"); House[i][hSlots] = strval(savingstring);
mysql_fetch_field_row(savingstring, "owned"); House[i][hOwned] = strval(savingstring);
if(House[i][hOwned] == 0) {
House[i][hPick] = CreateDynamicPickup(1273, 1, House[i][hPosX], House[i][hPosY], House[i][hPosZ]);
House[i][hPick2] = CreateDynamicPickup(1318, 1, 234.6087, 1187.8195, 1080.2578, i, 3, -1);
House[i][hMap] = CreateDynamicMapIcon(House[i][hPosX], House[i][hPosY], House[i][hPosZ], 31, 0);
House[i][Label] = Create3DTextLabel("House for sale!", COLOR_YELLOW, House[i][hPosX], House[i][hPosZ], House[i][hPosY], 30.0, 0);
} else {
new message[100];
format(message, sizeof(message), "House is owned by %s", House[i][hOwner]);
House[i][hPick] = CreateDynamicPickup(1273, 1, House[i][hPosX], House[i][hPosY], House[i][hPosZ]);
House[i][hPick2] = CreateDynamicPickup(1318, 1, 234.6087, 1187.8195, 1080.2578, i, 3, -1);
House[i][Label] = Create3DTextLabel(message, COLOR_YELLOW, House[i][hPosX], House[i][hPosZ], House[i][hPosY], 30.0, 0);
}
}
mysql_free_result();
}
return 1;
}
Put the MySQL debug on, and try again.
When you've done this, post the MySQL log. |
[12:32:31] [12:32:31] --------------------------- [12:32:31] MySQL Debugging activated (10/14/11) [12:32:31] --------------------------- [12:32:31]