24.05.2014, 06:14
I try to create mysql System but they not working when im try on my server
Anyone can help me pls !
Anyone can help me pls !
Load Mysql
Enum
Save MYSQL
Log Error
PHP код:
stock LoadBizs()
{
printf("[Loadbusiness] Dang Tai Du Lieu Tu Database....");
mysql_function_query(MainPipeline, "SELECT * FROM `business`", true, "OnLoadBizs", "");
}
forward OnLoadBizs();
public OnLoadBizs()
{
new string[512], i;
new businesstype[128];
new rows, fields;
cache_get_data(rows, fields, MainPipeline);
while(i<rows)
{
for(new field;field<fields;field++)
{
cache_get_row(i, field, string, MainPipeline);
switch(field)
{
case 0: BizzInfo[i][bSQLId] = strval(string);
case 1: BizzInfo[i][bOwned] = strval(string);
case 2: format(BizzInfo[i][bOwner], 24, "%s", string);
case 3: format(BizzInfo[i][bMessage], 255, "%s", string);
case 4: BizzInfo[i][bPickupID] = strval(string);
case 5: BizzInfo[i][bIconID] = strval(string);
case 6: BizzInfo[i][bIconType] = strval(string);
case 7: BizzInfo[i][bVirWorld] = strval(string);
case 8: BizzInfo[i][bExtortion] = strval(string);
case 9: BizzInfo[i][bLevelNeeded] = strval(string);
case 10: BizzInfo[i][bBuyPrice] = strval(string);
case 11: BizzInfo[i][bEntranceCost] = strval(string);
case 12: BizzInfo[i][bBizBank] = strval(string);
case 13: BizzInfo[i][bLocked] = strval(string);
case 14: BizzInfo[i][bProducts] = strval(string);
case 15: BizzInfo[i][bPriceProd] = strval(string);
case 16: BizzInfo[i][bDelivProd] = strval(string);
case 17: BizzInfo[i][bPercent] = strval(string);
case 18: BizzInfo[i][bType] = strval(string);
case 19: BizzInfo[i][bInterior] = strval(string);
case 20: BizzInfo[i][bInteriorID] = strval(string);
case 21: BizzInfo[i][bExteriorID] = strval(string);
case 22: BizzInfo[i][bExitX] = floatstr(string);
case 23: BizzInfo[i][bExitY] = floatstr(string);
case 24: BizzInfo[i][bExitZ] = floatstr(string);
case 25: BizzInfo[i][bEntranceX] = floatstr(string);
case 26: BizzInfo[i][bEntranceY] = floatstr(string);
case 27: BizzInfo[i][bEntranceZ] = floatstr(string);
case 28: BizzInfo[i][bDeliverX] = floatstr(string);
case 29: BizzInfo[i][bDeliverY] = floatstr(string);
case 30: BizzInfo[i][bDeliverZ] = floatstr(string);
case 31: BizzInfo[i][bGiaSP1] = strval(string);
case 32: BizzInfo[i][bGiaSP2] = strval(string);
case 33: BizzInfo[i][bGiaSP3] = strval(string);
case 34: BizzInfo[i][bGiaSP4] = strval(string);
case 35: BizzInfo[i][bGiaSP5] = strval(string);
case 36: BizzInfo[i][bGiaSP6] = strval(string);
case 37: BizzInfo[i][bGiaSP7] = strval(string);
case 38: BizzInfo[i][bGiaSP8] = strval(string);
case 39: BizzInfo[i][bGiaSP9] = strval(string);
case 40: BizzInfo[i][bGiaSP10] = strval(string);
case 41: BizzInfo[i][bGiaSP11] = strval(string);
case 42: BizzInfo[i][bGiaSP12] = strval(string);
case 43: BizzInfo[i][bGiaSP13] = strval(string);
case 44: BizzInfo[i][bGiaSP14] = strval(string);
case 45: BizzInfo[i][bGiaSP15] = strval(string);
case 46: BizzInfo[i][bPickkupModel] = strval(string);
case 47: BizzInfo[i][bWeapons1] = strval(string);
case 48: BizzInfo[i][bWeapons2] = strval(string);
case 49: BizzInfo[i][bWeapons3] = strval(string);
case 50: BizzInfo[i][bWeapons4] = strval(string);
case 51: BizzInfo[i][bWeapons5] = strval(string);
case 52: BizzInfo[i][bWeapons6] = strval(string);
case 53: BizzInfo[i][bWeapons7] = strval(string);
case 54: BizzInfo[i][bWeapons8] = strval(string);
case 55: BizzInfo[i][bWeapons9] = strval(string);
case 56: BizzInfo[i][bWeapons10] = strval(string);
case 57: BizzInfo[i][bVatLieu] = strval(string);
case 58: BizzInfo[i][bGiaMua] = strval(string);
case 59: BizzInfo[i][bLuong] [0]= strval(string);
case 60: BizzInfo[i][bLuong] [1] = strval(string);
case 61: BizzInfo[i][bLuong] [2] = strval(string);
case 62: BizzInfo[i][bLuong] [3] = strval(string);
case 63: BizzInfo[i][bLuong] [4] = strval(string);
case 64: BizzInfo[i][bLuong] [5] = strval(string);
case 65: BizzInfo[i][bBaoKe] = strval(string);
}
}
PickUpBiz(i);
//BizzInfo[i][bPickupID] = CreatePickupEx(1274, 23, BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ], 0 );
SpawnedBusinesses++;
if(BizzInfo[i][bType] > 0)
{
if(BizzInfo[i][bType] == 1) { businesstype = "Gas Station"; BizzInfo[i][bIconType] = 17;}
else if(BizzInfo[i][bType] == 2) { businesstype = "Clothes Store"; BizzInfo[i][bIconType] = 45;}
else if(BizzInfo[i][bType] == 3) { businesstype = "Club"; BizzInfo[i][bIconType] = 49;}
else if(BizzInfo[i][bType] == 4) { businesstype = "Ammunation"; BizzInfo[i][bIconType] = 6;}
else if(BizzInfo[i][bType] == 5) { businesstype = "Casino"; BizzInfo[i][bIconType] = BizzInfo[i][bIconType] = 25;}
else if(BizzInfo[i][bType] == 6) { businesstype = "Restaurant"; BizzInfo[i][bIconType] = 50;}
else if(BizzInfo[i][bType] == 7) { businesstype = "Paintball"; BizzInfo[i][bIconType] = 19;}
else if(BizzInfo[i][bType] == 8) { businesstype = "Bank"; BizzInfo[i][bIconType] = 52;}
else if(BizzInfo[i][bType] == 9) { businesstype = "Electronic Store"; BizzInfo[i][bIconType] = 48;}
else if(BizzInfo[i][bType] == 10) { businesstype = "Locks Store"; BizzInfo[i][bIconType] = 42;}
else if(BizzInfo[i][bType] == 11) { businesstype = "Radio Shop"; BizzInfo[i][bIconType] = 34; }
}
else
{
businesstype = "Dang xay dung";
}
BizzInfo[i][bIconID] = CreateDynamicMapIcon(BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ], BizzInfo[i][bIconType], 0, 0, -1, -1, 100.0);
new btext[30];
if( BizzInfo[i][bLocked] == 0 ) { btext = "{33AA33}Open"; }
if( BizzInfo[i][bLocked] == 1 ) { btext = "{AA3333}Close"; }
if(BizzInfo[i][bOwned] == 1)
{
format(string, sizeof(string), "%s\n\n\n\n{9E9E9E}%s\n\n%s [ So Huu: %s ]\nID: %d",btext, businesstype, BizzInfo[i][bMessage], BizzInfo[i][bOwner], i);
business1[i] = CreateDynamic3DTextLabel(string, 0xFFFFFF88, BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
format(string, sizeof(string), "{808080}Dia Diem Van Chuyen Hang\n\t%s\n\t%s\nID: %d",businesstype, BizzInfo[i][bMessage],i);
business3[i] = CreateDynamic3DTextLabel(string, 0xFFFFFF88, BizzInfo[i][bDeliverX]+ 1, BizzInfo[i][bDeliverY]+1, BizzInfo[i][bDeliverZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
}
else
{
format(string, sizeof(string), "%s\n\n\n\n{9E9E9E}%s \n\nBusiness For Sale!\nGia: $%s\nDe so huu no go lenh /buybiz\nID: %d",btext, businesstype,( BizzInfo[i][bBuyPrice], 0, ',' ), i);
business2[i] = CreateDynamic3DTextLabel(string, 0xFFFFFF88, BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
format(string, sizeof(string), "{808080}Dia Diem Van Chuyen Hang\n\t%s\n\t%s\nID: %d",businesstype, BizzInfo[i][bMessage],i);
business3[i] = CreateDynamic3DTextLabel(string, 0xFFFFFF88, BizzInfo[i][bDeliverX]+ 1, BizzInfo[i][bDeliverY]+1, BizzInfo[i][bDeliverZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
}
i++;
}
if(i > 0) printf("[LoadBusiness] %d cua hang da tai thanh cong.", i);
else printf("[LoadBusiness] Da say ra loi khi load du lieu tu Data Base.");
return 1;
}
PHP код:
enum bInfo
{
bSQLId,
bOwned,
bRadio,
bOwner[255],
bMessage[255],
bPickupID,
bIconID,
bIconType,
bVirWorld,
bExtortion[255],
Float:bEntranceX,
Float:bEntranceY,
Float:bEntranceZ,
Float:bDeliverX,
Float:bDeliverY,
Float:bDeliverZ,
Float:bExitX,
Float:bExitY,
Float:bExitZ,
bLevelNeeded,
bBuyPrice,
bEntranceCost,
bBizBank,
bLocked,
bInteriorID,
bExteriorID,
bInterior,
bProducts,
bDelivProd,
bPercent,
bType,
BusinessProdPrice[26],
BusinessPrice,
BusinessPickup,
Text3D:BusinessLabel,
BusinessFee,
BusinessProducts,
bPriceProd,
bMaxProducts,
bGiaSP1,
bGiaSP2,
bGiaSP3,
bGiaSP4,
bGiaSP5,
bGiaSP6,
bGiaSP7,
bGiaSP8,
bGiaSP9,
bGiaSP10,
bGiaSP11,
bGiaSP12,
bGiaSP13,
bGiaSP14,
bGiaSP15,
bPickkupModel,
bWeapons1,
bWeapons2,
bWeapons3,
bWeapons4,
bWeapons5,
bWeapons6,
bWeapons7,
bWeapons8,
bWeapons9,
bWeapons10,
bVatLieu,
bGiaMua,
bLuong[ 6 ],
bBaoKe,
};
new BizzInfo[MAX_BUSINESSES][bInfo];
PHP код:
stock SaveBusiness(bizid)
{
new string[2948];
format(string, sizeof(string), "UPDATE `business` SET \
`Owned`=%d, \
`Owner`='%s', \
`Name`='%s', \
`PickupID`=%d, \
`IconID`=%d, \
`IconType`=%d, \
`VirtualWorld`=%d, \
`Extortion`=%d, \
`Level`=%d, \
`Price`=%d, \
`EntranceCost`=%d, \
`BusinessBank`=%d, \
`Locked`=%d, \
`Products`=%d, \
`PriceProd`=%d, \
`DeliveringProducts`=%d, \
`Percent`=%d, \
`BusinessType`=%d, \
`Interior`=%d, \
`InteriorID`=%d, \
`ExteriorID`=%d,",
BizzInfo[bizid][bOwned],
BizzInfo[bizid][bOwner],
BizzInfo[bizid][bMessage],
BizzInfo[bizid][bPickupID],
BizzInfo[bizid][bIconID],
BizzInfo[bizid][bIconType],
BizzInfo[bizid][bVirWorld],
BizzInfo[bizid][bExtortion],
BizzInfo[bizid][bLevelNeeded],
BizzInfo[bizid][bBuyPrice],
BizzInfo[bizid][bEntranceCost],
BizzInfo[bizid][bBizBank],
BizzInfo[bizid][bLocked],
BizzInfo[bizid][bProducts],
BizzInfo[bizid][bPriceProd],
BizzInfo[bizid][bDelivProd],
BizzInfo[bizid][bPercent],
BizzInfo[bizid][bType],
BizzInfo[bizid][bInterior],
BizzInfo[bizid][bInteriorID],
BizzInfo[bizid][bExteriorID]
);
format(string, sizeof(string), "%s \
`InteriorX`=%f, \
`InteriorY`=%f, \
`InteriorZ`=%f, \
`EntranceX`=%f, \
`EntranceY`=%f, \
`EntranceZ`=%f, \
`DeliverX`=%f, \
`DeliverY`=%f, \
`DeliverZ`=%f, \
`GiaSP1`=%d, \
`GiaSP2`=%d, \
`GiaSP3`=%d, \
`GiaSP4`=%d, \
`GiaSP5`=%d, \
`GiaSP6`=%d, \
`GiaSP7`=%d, \
`GiaSP8`=%d, \
`GiaSP9`=%d, \
`GiaSP10`=%d, \
`GiaSP11`=%d, \
`GiaSP12`=%d, \
`GiaSP13`=%d, \
`GiaSP14`=%d, \
`GiaSP15`=%d, \
`PickkupModel`=%d,",
string,
BizzInfo[bizid][bExitX],
BizzInfo[bizid][bExitY],
BizzInfo[bizid][bExitZ],
BizzInfo[bizid][bEntranceX],
BizzInfo[bizid][bEntranceY],
BizzInfo[bizid][bEntranceZ],
BizzInfo[bizid][bDeliverX],
BizzInfo[bizid][bDeliverY],
BizzInfo[bizid][bDeliverZ],
BizzInfo[bizid][bGiaSP1],
BizzInfo[bizid][bGiaSP2],
BizzInfo[bizid][bGiaSP3],
BizzInfo[bizid][bGiaSP4],
BizzInfo[bizid][bGiaSP5],
BizzInfo[bizid][bGiaSP6],
BizzInfo[bizid][bGiaSP7],
BizzInfo[bizid][bGiaSP8],
BizzInfo[bizid][bGiaSP9],
BizzInfo[bizid][bGiaSP10],
BizzInfo[bizid][bGiaSP11],
BizzInfo[bizid][bGiaSP12],
BizzInfo[bizid][bGiaSP13],
BizzInfo[bizid][bGiaSP14],
BizzInfo[bizid][bGiaSP15],
BizzInfo[bizid][bPickkupModel]
);
format(string, sizeof(string), "%s \
`Weapon0`=%d, \
`Weapon1`=%d, \
`Weapon2`=%d, \
`Weapon3`=%d, \
`Weapon4`=%d, \
`Weapon5`=%d, \
`Weapon6`=%d, \
`Weapon7`=%d, \
`Weapon8`=%d, \
`Weapon9`=%d, \
`VatLieu`=%d, \
`GiaMuaVL`=%d, \
`Luong1`=%d, \
`Luong2`=%d, \
`Luong3`=%d, \
`Luong4`=%d, \
`Luong5`=%d, \
`Luong6` =%d,\
`BaoKe`= %d WHERE `id`=%d",
string,
BizzInfo[bizid][bWeapons1],
BizzInfo[bizid][bWeapons2],
BizzInfo[bizid][bWeapons3],
BizzInfo[bizid][bWeapons4],
BizzInfo[bizid][bWeapons5],
BizzInfo[bizid][bWeapons6],
BizzInfo[bizid][bWeapons7],
BizzInfo[bizid][bWeapons8],
BizzInfo[bizid][bWeapons9],
BizzInfo[bizid][bWeapons10],
BizzInfo[bizid][bVatLieu],
BizzInfo[bizid][bGiaMua],
BizzInfo[bizid][bLuong] [0],
BizzInfo[bizid][bLuong] [1],
BizzInfo[bizid][bLuong] [2],
BizzInfo[bizid][bLuong] [3],
BizzInfo[bizid][bLuong] [4],
BizzInfo[bizid][bLuong] [5],
BizzInfo[bizid][bBaoKe],
bizid+1
); // Array starts from zero, MySQL starts at 1 (this is why we are adding one).
mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
}
PHP код:
[01:21:11] UPDATE `business` SET `Owned`=0, `Owner`='', `Name`='', `PickupID`=427, `IconID`=28, `IconType`=45, `VirtualWorld`=182255, `Extortion`=0, `Level`=0, `Price`=1, `EntranceCost`=0, `BusinessBank`=0, `Locked`=1, `Products`=0, `PriceProd`=0, `DeliveringProducts`=0, `Percent`=0, `BusinessType`=2, `Interior`=6, `InteriorID`=0, `ExteriorID`=0, `InteriorX`=748.397766, `InteriorY`=1437.077270, `InteriorZ`=1102.953125, `EntranceX`=-1560.782958, `EntranceY`=107.523048, `EntranceZ`=3.554687, `DeliverX`=0.000000, `DeliverY`=0.000000, `DeliverZ`=0.000000, `GiaSP1`=0, `GiaSP2`=0, `GiaSP3`=0, `GiaSP4`=0, `GiaSP5`=0, `GiaSP6`=0, `GiaSP7`=0, `GiaSP8`=0, `GiaSP9`=0, `GiaSP10`=0, `GiaSP11`=0, `GiaSP12`=0, `GiaSP13`=0, `GiaSP14`=0, `GiaSP15`=0, `PickkupModel`=0, `Weapon0`=0, `Weapon1`=0, `Weapon2`=0, `Weapon3`=0, `Weapon4`=0, `Weapon5`=0, `Weapon6`=0, `Weapon7`=0, `Weapon8`=0, `Weapon9`=0, `VatLieu`=0, `GiaMuaVL`=0, `Luong1`=0, `Luong2`=0, `Luong3`=0, `Luong4`=0, `Luong5`=0, `Luong6` =0,`BaoKe`= 0 WHERE `id`=2
[01:21:19] [MySQL] Query Error - (ErrorID: 1054) (Handle: 1)
[01:21:19] [MySQL] Check /logs/querydump.log to review the query that threw the error.
[01:21:19] Dumping query from 2014/5/24 (1:21:19)
Description: Unknown column 'id' in 'where clause' (index 0). Query: