PDA

View Full Version : load problem (mysql)


Stefans94
14/10/2011, 03:48 PM
no errors on compiling..
i made a /createhouse command (works) and made a house with it(worked XD)

no errors on the server..
but it doesn't work.. it won't load the houses..


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;
}

SVRP
14/10/2011, 04:19 PM
Put the MySQL debug on, and try again.
When you've done this, post the MySQL log.

Stefans94
14/10/2011, 04:30 PM
Put the MySQL debug on, and try again.
When you've done this, post the MySQL log.

lol weird
i put it on
mysql_log file:
[12:32:31]
[12:32:31] ---------------------------
[12:32:31] MySQL Debugging activated (10/14/11)
[12:32:31] ---------------------------
[12:32:31]


i made a new house
and now it only displays house 1 xD not house 2

Stefans94
14/10/2011, 04:40 PM
fixed it.