MySQL - Gives all no value back, but database is filled
#6

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
I can believe that, TBH I only load 30 houses. This has worked before on a database in GTA Multi, and now on this database it doesn't. Could it be this database is weaker?

Edit: 'result' would put out the whole row, right? Then I got to split it, which I am trying to evade.
You can use the mysql_get_field function inside the while statement so that you don't have to split the line.

pawn Код:
mysql_query("SELECT * FROM `HouseInfo`");
mysql_store_result();
new h;
while(mysql_fetch_row(result))
{
    mysql_get_field("PickupOutsidePosX",Store); HouseInfo[h][PickupOutsidePosX] = floatstr(Store);
    mysql_get_field("PickupOutsidePosY",Store); HouseInfo[h][PickupOutsidePosY] = floatstr(Store);
    mysql_get_field("PickupOutsidePosZ",Store); HouseInfo[h][PickupOutsidePosZ] = floatstr(Store);
    mysql_get_field("PickupInsidePosX",Store); HouseInfo[h][PickupInsidePosX] = floatstr(Store);
    mysql_get_field("PickupInsidePosY",Store); HouseInfo[h][PickupInsidePosY] = floatstr(Store);
    mysql_get_field("PickupInsidePosZ",Store); HouseInfo[h][PickupInsidePosZ] = floatstr(Store);
    mysql_get_field("SpawnOutsideX",Store); HouseInfo[h][SpawnOutsideX] = floatstr(Store);
    mysql_get_field("SpawnOutsideY",Store); HouseInfo[h][SpawnOutsideY] = floatstr(Store);
    mysql_get_field("SpawnOutsideZ",Store); HouseInfo[h][SpawnOutsideZ] = floatstr(Store);
    mysql_get_field("SpawnOutsideAngle",Store); HouseInfo[h][SpawnOutsideAngle] = floatstr(Store);
    mysql_get_field("SpawnInsideX",Store); HouseInfo[h][SpawnInsideX] = floatstr(Store);
    mysql_get_field("SpawnInsideY",Store); HouseInfo[h][SpawnInsideY] = floatstr(Store);
    mysql_get_field("SpawnInsideZ",Store); HouseInfo[h][SpawnInsideZ] = floatstr(Store);
    mysql_get_field("SpawnInsideAngle",Store); HouseInfo[h][SpawnInsideAngle] = floatstr(Store);
    mysql_get_field("InteriorID",Store); HouseInfo[h][InteriorID] = strval(Store);
    mysql_get_field("Locked",Store); HouseInfo[h][Locked] = strval(Store);
    mysql_get_field("Price",Store); HouseInfo[h][Price] = strval(Store);
    mysql_get_field("Owner",HouseInfo[h][Owner]);
    HouseInfo[h][VirtualWorld] = h;
    HouseInfo[h][Owned] = 1;
    if(!strlen(HouseInfo[h][Owner])) HouseInfo[h][PickupID] = CreateDynamicPickup(1273,23,HouseInfo[h][PickupOutsidePosX],HouseInfo[h][PickupOutsidePosY],HouseInfo[h][PickupOutsidePosZ],-1,-1,-1,200.0);
    else HouseInfo[h][PickupID] = CreateDynamicPickup(1272,23,HouseInfo[h][PickupOutsidePosX],HouseInfo[h][PickupOutsidePosY],HouseInfo[h][PickupOutsidePosZ],-1,-1,-1,200.0);
    printf("House File ID %d has been created",h);
    h++;
}
mysql_free_result();
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)