Szerző Téma: Mysql mentés gond  (Megtekintve 541 alkalommal)

Nem elérhető Game94

  • 405
    • Profil megtekintése
Mysql mentés gond
« Dátum: 2012. Január 16. - 17:04:52 »
0 Show voters
Írtam egy /createhouse parancsot, minden tökéletesen mûködik benne, kivéve a mysql-be való mentés. Létrehozza a textlabel-t, létrehozza a pickupot, de nem menti el.
Mi lehet a hiba ? (ez kb a 20. változat, szóval lehet hogy ebbe már nagy hülyeségeket írtam..)
[pawn]stock CreateHouse(Float: EnterX, Float: EnterY, Float: EnterZ, Float: ExitX, Float: ExitY, Float: ExitZ, Interior, Ar)
{
new searchString[200];
for(new h = 1; h < MAX_HOUSES; h++)
{
   format(searchString, sizeof(searchString), \"SELECT * FROM `houses` WHERE houseID = %d\", h);
   mysql_query(searchString);
   mysql_store_result();
   if(mysql_num_rows() == 0)
   {
      new VW = 100000 + h;
      format(sqlString, sizeof(sqlString), \"INSERT INTO `houses` (`houseID` `EnterX`, `EnterY`, `EnterZ`, `ExitX`, `ExitY`, `ExitZ`, `Interior`, `VirtualWorld`, `Ar`) VALUES\");
      format(sqlString, sizeof(sqlString), \"%s (\'%d\', \'%f\', \'%f\', \'%f\', \'%f\', \'%f\', \'%f\', \'%d\', \'%d\', \'%d\', \'%d\')\", sqlString, h, EnterX, EnterY, EnterZ, ExitX, ExitY, ExitZ, Interior, VW, Ar);
      mysql_query(sqlString);
      format(HouseInfo[h][hTulaj], 24, \"None\");
      HouseInfo[h][hEnterX] = EnterX;
      HouseInfo[h][hEnterY] = EnterY;
      HouseInfo[h][hEnterZ] = EnterZ;
      HouseInfo[h][hExitX] = ExitX;
      HouseInfo[h][hExitY] = ExitY;
      HouseInfo[h][hExitZ] = ExitZ;
      HouseInfo[h][hInterior] = Interior;
      HouseInfo[h][hVirtualWorld] = VW;
      HouseInfo[h][hAr] = Ar;
      HouseInfo[h][hOwned] = -1;
      HouseInfo[h][hPickup] = CreatePickup(1273, 1, EnterX, EnterY, EnterZ, 0);
      format(houseString, sizeof(houseString), \"Eladó Ház [%d]\\nÁra: %d$\", h, HouseInfo[h][hAr]);
      format(HouseInfo[h][hSzoveg], 50, \"%s\", houseString);
      HouseInfo[h][hTextSzoveg] = Create3DTextLabel(houseString, 0x33AA33AA, EnterX, EnterY, EnterZ, 40.0, 0);
      break;
   }
}
}[/pawn]

Nem elérhető Norby

  • 1575
    • Profil megtekintése
Mysql mentés gond
« Válasz #1 Dátum: 2012. Január 17. - 14:32:04 »
0 Show voters
Nem hiszem hogy ez a hiba de ha van mysql_store_result(); akkor szabad vissza térésnek is lennie kell.
mysql_free_result();
SELECT itt hol kérdezed le . . ?
így szerintem nem fogja tudni mit akarsz :
 
format(searchString, sizeof(searchString), \"SELECT * FROM `houses` WHERE houseID = %d\", h);

 
sscanf -al :
 
new searchString[200],line[256];
format(searchString, sizeof(searchString), \"SELECT * FROM `houses` WHERE houseID = %d\", h);
mysql_query(searchString);
mysql_store_result();
mysql_fetch_row(line);
mysql_free_result();
sscanf(line,\"p<|>ffffffdd\");

 
Lehet hogy hülyeséget mondtam.... :D

Nem elérhető Game94

  • 405
    • Profil megtekintése
Mysql mentés gond
« Válasz #2 Dátum: 2012. Január 17. - 15:28:46 »
0 Show voters
Az a baj, hogy ez betöltés és nekem nem ez kell.
Nekem az kell hogy egy ciklussal el kezdi leellenõrizni hogy melyik id-jû házaknál van találat.
Ha talált valamit akkor tovább fut, de ha üres sort talál akkor oda hozza létre a házat.

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal