Saving house in Mysql. Not working perfectly.
#1

Hello

I put 241 homes in the houses of the mysql table.
I did load the home. Until then everything works perfectly. More time to save, not save every home, only 106 of 241.
and the gamemode, half of a locked. I can not explain well, just that there's something wrong. If someone can help me, I will be very grateful and happy.

Thank you!

Below is the code of my attempt.

pawn Код:
mysql_function_query(Connect, "SELECT * FROM `casas`", true, "SaveHouses", "");
pawn Код:
forward SaveHouses();
public SaveHouses()
{
    new rows, fields,TotalCasas;
    cache_get_data(rows, fields);
    while(TotalCasas < rows)
    {
        new Str[315];
        format(Str,163,"UPDATE `casas` SET `HealthX`='%f',`HealthY`='%f',`HealthZ`='%f',`ArmorrX`='%f',`ArmorrY`='%f',`ArmorrZ`='%f',",HouseInfo[TotalCasas][hHealthx],
        HouseInfo[TotalCasas][hHealthy],HouseInfo[TotalCasas][hHealthz],HouseInfo[TotalCasas][hArmorrx],HouseInfo[TotalCasas][hArmorry],HouseInfo[TotalCasas][hArmorrz]);
        format(Str,380,"%s`Dono`='%s',`Descricao`='%s',`Valor`='%i',`Saude`='%i',`Colete`='%i',`Interior`='%i',`Trancado`='%i',`Vendido`='%i',",Str,HouseInfo[TotalCasas][hOwner],
        HouseInfo[TotalCasas][hDiscription],HouseInfo[TotalCasas][hValue],HouseInfo[TotalCasas][hHel],HouseInfo[TotalCasas][hArm],HouseInfo[TotalCasas][hInt],HouseInfo[TotalCasas][hLock],HouseInfo[TotalCasas][hOwned]);
        format(Str,557,"%s`Rooms`='%i',`Rent`='%i',`Rentabil`='%i',`Takings`='%i',`Vec`='%i',`Vcol1`='%i',`Vcol2`='%i',`Data`='%i',",Str,HouseInfo[TotalCasas][hRooms],HouseInfo[TotalCasas][hRent],
        HouseInfo[TotalCasas][hRentabil],HouseInfo[TotalCasas][hTakings],HouseInfo[TotalCasas][hVec],HouseInfo[TotalCasas][hVcol1],HouseInfo[TotalCasas][hVcol2],HouseInfo[TotalCasas][hDate]);
        format(Str,603,"%s`Level`='%i' WHERE `ID`='%i'",Str,HouseInfo[TotalCasas][hLevel],TotalCasas);
        mysql_function_query(Connect, Str, false, "","");
        //print("");
        //print(Str);
        TotalCasas++;
    }
    printf("[BVS]: %d Houses Loaded",TotalCasas);
    return 1;
}
Many thanks to those who help, and those who try to help too!
Reply
#2

Any help ? =/
Reply
#3

Someone help me please =/
Reply
#4

What does your SQL error log say and what does your sql query look like when you print it?

Also: if you create a string that is 318 chars/bytes whatever long, why are you setting the size to 603? You are double the maximum size.
Reply
#5

I swear to you. I looked letter by letter and saw the string with different sizes. When corrected and tested, saved the 241 homes perfectly ... Sorry to waste your time with nonsense. More thank you very much!
I was going crazy!

++REP
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)