[HELP]please help mysql load houses
#1

mysql wrong load house data but in database is everything fine


this is load house

this

pawn Код:
case THREAD_KUCE:
        {
            mysql_store_result();
            if(mysql_num_rows() > 0)
            {
                new id = mysql_fetch_int() + 1;
                mysql_free_result();
                for(new i = 0; i < id; i++)
                {
                    format(ustring,128,"SELECT * FROM `kuce` WHERE `ID` = '%d' LIMIT 1",id);
                    mysql_query(ustring,THREAD_UCITAJKUCU,id);
                }
            }
        }
then this


pawn Код:
case THREAD_UCITAJKUCU:
        {
            mysql_store_result();
            new linija[270],result[800];
            if(mysql_num_rows() == 1)
            {
                if(mysql_fetch_row(linija))
                {
                    mysql_free_result();
                    new k[2];
                    sscanf(linija,"p<|>iffffffiiiiiiiiis[24]s[32]iiis[32]iiiiiiiiii",
                    k[0],KucaInfo[extraid][hUlazX],KucaInfo[extraid][hUlazY],KucaInfo[extraid][hUlazZ],KucaInfo[extraid][hIzlazX],KucaInfo[extraid][hIzlazY],
                    KucaInfo[extraid][hIzlazZ],KucaInfo[hTip],KucaInfo[extraid][hLevel],KucaInfo[extraid][hRooms],KucaInfo[extraid][hInt],KucaInfo[extraid][hHel],KucaInfo[extraid][hArm],KucaInfo[extraid][hImaVlasnika],KucaInfo[extraid][hWorld],KucaInfo[extraid][hCijena],
                    KucaInfo[extraid][hOpis],KucaInfo[extraid][hVlasnik],KucaInfo[extraid][hRentabil],KucaInfo[extraid][hRent],KucaInfo[extraid][hLock],KucaInfo[extraid][hAdresa],KucaInfo[extraid][hSef],KucaInfo[extraid][hDroga],
                    KucaInfo[extraid][hMats],KucaInfo[extraid][Oruzje1],KucaInfo[extraid][Municija1],KucaInfo[extraid][Oruzje2],KucaInfo[extraid][Municija2],KucaInfo[extraid][Oruzje3],KucaInfo[extraid][Municija3],k[1]);
                    SpawnedHouses++;
                    print(linija);
                    if(KucaInfo[extraid][hImaVlasnika] == 0)
                    {
                        format(result,800,"{0ed400}Na Prodaju\n{0ed400}Opis: {FFFFFF}%s\n{0ed400}Level: {FFFFFF}%d\n{0ed400}Adresa: {FFFFFF}%s\n{0ed400}Cijena: {FFFFFF}%d$",KucaInfo[extraid][hOpis],KucaInfo[extraid][hLevel],KucaInfo[extraid][hAdresa],KucaInfo[extraid][hCijena]);
                        KucaLabel[extraid] = CreateDynamic3DTextLabel(result,0x00FF00FF,KucaInfo[extraid][hUlazX],KucaInfo[extraid][hUlazY],KucaInfo[extraid][hUlazZ],10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0);
                        KucaPickup[extraid] = CreateDynamicPickup(1273,1,KucaInfo[extraid][hUlazX],KucaInfo[extraid][hUlazY],KucaInfo[extraid][hUlazZ]);}
                    }
                    else if(KucaInfo[extraid][hImaVlasnika] == 1)
                    {
                        if(KucaInfo[extraid][hRentabil] == 0)
                        {
                            format(result,800,"{0ed400}Vlasnik Kuce: {FFFFFF}%s\n{0ed400}Opis: {FFFFFF}%s\n{0ed400}Level: {FFFFFF}%d\n{0ed400}Adresa: {FFFFFF}%s",KucaInfo[extraid][hVlasnik],KucaInfo[extraid][hOpis],KucaInfo[extraid][hLevel],KucaInfo[extraid][hAdresa]);
                        }
                        else if(KucaInfo[extraid][hRentabil] == 1)
                        {
                            format(result,800,"{0ed400}Vlasnik Kuce: {FFFFFF}%s\n{0ed400}Opis: {FFFFFF}%s\n{0ed400}Level: {FFFFFF}%d\n{0ed400}Adresa: {FFFFFF}%s\n{0ed400}Rent: {FFFFFF}%d$\n{0ed400}Najam: {FFFFFF}/rentroom",KucaInfo[extraid][hVlasnik],KucaInfo[extraid][hOpis],KucaInfo[extraid][hLevel],KucaInfo[extraid][hAdresa],KucaInfo[extraid][hRent]);
                        }
                        KucaLabel[extraid] = CreateDynamic3DTextLabel(result,0x0ed400AA,KucaInfo[extraid][hUlazX],KucaInfo[extraid][hUlazY],KucaInfo[extraid][hUlazZ],10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0);
                        KucaPickup[extraid] = CreateDynamicPickup(1239,1,KucaInfo[extraid][hUlazX],KucaInfo[extraid][hUlazY],KucaInfo[extraid][hUlazZ]);
                    }
                }
            //}
        }
Reply
#2

I'm not familiar with such an old method but shouldn't you be freeing the result AFTER you've manipulated it? Put the mysql_free_result at the end of the THREAD_UCITAJKUCU
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)