Save HouseANDBizz
#1

Godfather mode 2007)). I'm from Ukraine,I do not understand English well...

PHP код:
public OnPropUpdate()
{
    new 
query[3000];
    for(new 
0sizeof(HouseInfo); h++){
        
query "UPDATE `accounts` SET ";
        
format(querysizeof(query), "%s `x1` = '%2.f',"queryHouseInfo[h][hEntrancex]);
        
format(querysizeof(query), "%s `y1` = '%2.f',"queryHouseInfo[h][hEntrancey]);
        
format(querysizeof(query), "%s `z1` = '%2.f',"queryHouseInfo[h][hEntrancez]);
        
format(querysizeof(query), "%s `x2` = '%2.f',"queryHouseInfo[h][hExitx]);
        
format(querysizeof(query), "%s `y2` = '%2.f',"queryHouseInfo[h][hExity]);
        
format(querysizeof(query), "%s `z2` = '%2.f',"queryHouseInfo[h][hExitz]);
        
format(querysizeof(query), "%s `healthx` = '%i',"queryHouseInfo[h][hHealthx]);
        
format(querysizeof(query), "%s `healthy` = '%i',"queryHouseInfo[h][hHealthy]);
        
format(querysizeof(query), "%s `healthz` = '%i',"queryHouseInfo[h][hHealthz]);
        
format(querysizeof(query), "%s `armourx` = '%i',"queryHouseInfo[h][hArmourx]);
        
format(querysizeof(query), "%s `armoury` = '%i',"queryHouseInfo[h][hArmoury]);
        
format(querysizeof(query), "%s `armourz` = '%i',"queryHouseInfo[h][hArmourz]);
        
format(querysizeof(query), "%s `owner` = '%s',"queryHouseInfo[h][hOwner]);
        
format(querysizeof(query), "%s `discription` = '%s',"queryHouseInfo[h][hDiscription]);
        
format(querysizeof(query), "%s `value` = '%i',"queryHouseInfo[h][hValue]);
        
format(querysizeof(query), "%s `hel` = '%i',"queryHouseInfo[h][hHel]);
        
format(querysizeof(query), "%s `arm` = '%i',"queryHouseInfo[h][hArm]);
        
format(querysizeof(query), "%s `int` = '%i',"queryHouseInfo[h][hInt]);
        
format(querysizeof(query), "%s `lock` = '%i',"queryHouseInfo[h][hLock]);
        
format(querysizeof(query), "%s `owned` = '%i',"queryHouseInfo[h][hOwned]);
        
format(querysizeof(query), "%s `rooms` = '%i',"queryHouseInfo[h][hRooms]);
        
format(querysizeof(query), "%s `rent` = '%i',"queryHouseInfo[h][hRent]);
        
format(querysizeof(query), "%s `rentabil` = '%i',"queryHouseInfo[h][hRentabil]);
        
format(querysizeof(query), "%s `takings` = '%i',"queryHouseInfo[h][hTakings]);
        
format(querysizeof(query), "%s `vec` = '%i',"queryHouseInfo[h][hVec]);
        
format(querysizeof(query), "%s `vcol1` = '%i',"queryHouseInfo[h][hVcol1]);
        
format(querysizeof(query), "%s `vcol2` = '%i',"queryHouseInfo[h][hVcol2]);
        
format(querysizeof(query), "%s `date` = '%i',"queryHouseInfo[h][hDate]);
        
format(querysizeof(query), "%s `level` = '%i',"queryHouseInfo[h][hLevel]);
        
format(querysizeof(query), "%s WHERE `hID` = '%d'"queryHouseInfo[h][hID]);
        
mysql_tquery(g_SQLquery"""");}
        
        for(new 
0sizeof(BizzInfo); b++){
        
query "UPDATE `accounts` SET ";
        
format(querysizeof(query), "%s `owned` = '%i',"queryBizzInfo[b][bOwned]);
        
format(querysizeof(query), "%s `owner` = '%s',"queryBizzInfo[b][bOwner]);
        
format(querysizeof(query), "%s `message` = '%s',"queryBizzInfo[b][bMessage]);
        
format(querysizeof(query), "%s `extortion` = '%s',"queryBizzInfo[b][bExtortion]);
        
format(querysizeof(query), "%s `x` = '%2.f',"queryBizzInfo[b][bEntranceX]);
        
format(querysizeof(query), "%s `y` = '%2.f',"queryBizzInfo[b][bEntranceY]);
        
format(querysizeof(query), "%s `z` = '%2.f',"queryBizzInfo[b][bEntranceZ]);
        
format(querysizeof(query), "%s `ex` = '%2.f',"queryBizzInfo[b][bExitX]);
        
format(querysizeof(query), "%s `ey` = '%2.f',"queryBizzInfo[b][bExitY]);
        
format(querysizeof(query), "%s `ez` = '%2.f',"queryBizzInfo[b][bExitZ]);
        
format(querysizeof(query), "%s `levelneed` = '%i',"queryBizzInfo[b][bLevelNeeded]);
        
format(querysizeof(query), "%s `buyprice` = '%i',"queryBizzInfo[b][bBuyPrice]);
        
format(querysizeof(query), "%s `enter` = '%i',"queryBizzInfo[b][bEntranceCost]);
        
format(querysizeof(query), "%s `till` = '%i',"queryBizzInfo[b][bTill]);
        
format(querysizeof(query), "%s `lock` = '%i',"queryBizzInfo[b][bLocked]);
        
format(querysizeof(query), "%s `int` = '%i',"queryBizzInfo[b][bInterior]);
        
format(querysizeof(query), "%s `prods` = '%i',"queryBizzInfo[b][bProducts]);
        
format(querysizeof(query), "%s `maxprods` = '%i',"queryBizzInfo[b][bMaxProducts]);
        
format(querysizeof(query), "%s `priceprods` = '%i',"queryBizzInfo[b][bPriceProd]);
        
format(querysizeof(query), "%s WHERE `bID` = '%d'"queryBizzInfo[b][bID]);
        
mysql_tquery(g_SQLquery"""");}
        
        for(new 
sb 0sb sizeof(SBizzInfo); sb++){
        
query "UPDATE `accounts` SET ";
        
format(querysizeof(query), "%s `owned` = '%i',"querySBizzInfo[sb][sbOwned]);
        
format(querysizeof(query), "%s `owner` = '%s',"querySBizzInfo[sb][sbOwner]);
        
format(querysizeof(query), "%s `message` = '%s',"querySBizzInfo[sb][sbMessage]);
        
format(querysizeof(query), "%s `extortion` = '%s',"querySBizzInfo[sb][sbExtortion]);
        
format(querysizeof(query), "%s `x` = '%2.f',"querySBizzInfo[sb][sbEntranceX]);
        
format(querysizeof(query), "%s `y` = '%2.f',"querySBizzInfo[sb][sbEntranceY]);
        
format(querysizeof(query), "%s `z` = '%2.f',"querySBizzInfo[sb][sbEntranceZ]);
        
format(querysizeof(query), "%s `levelneed` = '%i',"querySBizzInfo[sb][sbLevelNeeded]);
        
format(querysizeof(query), "%s `buyprice` = '%i',"querySBizzInfo[sb][sbBuyPrice]);
        
format(querysizeof(query), "%s `enter` = '%i',"querySBizzInfo[sb][sbEntranceCost]);
        
format(querysizeof(query), "%s `till` = '%i',"querySBizzInfo[sb][sbTill]);
        
format(querysizeof(query), "%s `lock` = '%i',"querySBizzInfo[sb][sbLocked]);
        
format(querysizeof(query), "%s `int` = '%i',"querySBizzInfo[sb][sbInterior]);
        
format(querysizeof(query), "%s `prods` = '%i',"querySBizzInfo[sb][sbProducts]);
        
format(querysizeof(query), "%s `maxprods` = '%i',"querySBizzInfo[sb][sbMaxProducts]);
        
format(querysizeof(query), "%s `priceprods` = '%i',"querySBizzInfo[sb][sbPriceProd]);
        
format(querysizeof(query), "%s WHERE `sbID` = '%d'"querySBizzInfo[sb][sbID]);
        
mysql_tquery(g_SQLquery"""");}
        return 
1;

does not save data.
Mysql LOG'S : CMySQLQuery::Execute[] ERROR (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `hID` = '0'' at line 1.

and in general, the code is optimized?.does not preserve (((((
Reply
#2

Remove the comma before the WHERE clause in level = .

Also, I doubt businesses and houses are both in the accounts table?
Reply
#3

table exists. removed the comma and it turned out: 19:25:30 CMySQLQuery::Execute[] ERROR (error #1054) Unknown column 'hID' in 'where clause'
19:25:30 CMySQLQuery::Execute[] ERROR (error #1054) Unknown column 'bID' in 'where clause'
19:25:30 CMySQLQuery::Execute[] ERROR (error #1054) Unknown column 'sbID' in 'where clause'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)