26.11.2015, 14:57
My function loadhouses
Even if i have already created a house and correctly have inserted a row with house info in my database it says there are no houses to load! any idea?
PHP код:
function LoadHouses()
{
new query[200];
new rows, fields;
cache_get_data(rows, fields, mysql);
if(rows)
{
for (new i = 1; i < MAX_HOUSES; i++)
{
mysql_format(mysql,query,sizeof(query),"SELECT * FROM `houses` WHERE `hID` = %d",i);
mysql_tquery(mysql,query);
HouseInfo[i][XEnt] = cache_get_field_content_float(0, "XEnt"); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
HouseInfo[i][YEnt] = cache_get_field_content_float(0, "YEnt"); //Above
HouseInfo[i][ZEnt] = cache_get_field_content_float(0, "ZEnt");//Above
HouseInfo[i][XExit] = cache_get_field_content_float(0, "XExit");//Above. Since player's position is a float, we use cache_get_field_content_float
HouseInfo[i][YExit] = cache_get_field_content_float(0, "YExit");//Above
HouseInfo[i][ZExit] = cache_get_field_content_float(0, "ZExit");//Above
HouseInfo[i][HVirtualWorld] = cache_get_field_content_int(0, "HVirtualWorld");
HouseInfo[i][HInterior] = cache_get_field_content_int(0, "HInterior");
HouseInfo[i][HPrice] = cache_get_field_content_int(0, "HPrice");
cache_get_field_content(0,"HOwnerID",HouseInfo[i][HOwnerID], 24);
HouseInfo[i][HOwned] = cache_get_field_content_int(0, "HOwned");
HouseInfo[i][HLocked] = cache_get_field_content_int(0, "HLocked");
cache_get_field_content(0, "HName", HouseInfo[i][HName], 30);
}
print("Successfully Loaded All Houses!");
}
else if(!rows)
{
print("There are no houses to load!");
}
return 1;
}