theDokree
Новичок
Личные авто не сохраняются в базу.
MySQL Log, танцевал с бубном вокруг vID, ничего не смог придумать:
Второй способ тоже не работает:
Код:
public SaveVehicles()
{
for(new vehicleid = 0; vehicleid < TOTALVEH; vehicleid++)
{
new temp[128], str_veh[1024]; //
mysql_format(con_bd, str_veh, sizeof(str_veh), "UPDATE `cars` SET ");
format(temp,sizeof(temp),"`vModel`= '%d',",veh_info[vehicleid][vModel]);strcat(str_veh,temp,sizeof(str_veh));
format(temp,sizeof(temp),"`vSpwnx`= '%f',",veh_info[vehicleid][vSpwx]);strcat(str_veh,temp,sizeof(str_veh));
format(temp,sizeof(temp),"`vSpwny`= '%f',",veh_info[vehicleid][vSpwy]);strcat(str_veh,temp,sizeof(str_veh));
format(temp,sizeof(temp),"`vSpwnz`='%f',",veh_info[vehicleid][vSpwz]);strcat(str_veh,temp,sizeof(str_veh));
format(temp,sizeof(temp),"`vSpwnf`='%f',",veh_info[vehicleid][vSpwf]);strcat(str_veh,temp,sizeof(str_veh));
format(temp,sizeof(temp),"`vPrice`='%d',",veh_info[vehicleid][vPrice]);strcat(str_veh,temp,sizeof(str_veh));
format(temp,sizeof(temp),"`vOwner`='%s',",veh_info[vehicleid][vOwner]);strcat(str_veh,temp,sizeof(str_veh));
format(temp,sizeof(temp),"`vLocked`='%d',",veh_info[vehicleid][vLocked]);strcat(str_veh,temp,sizeof(str_veh));
format(temp,sizeof(temp),"`vColor1`='%d',",veh_info[vehicleid][vColor1]);strcat(str_veh,temp,sizeof(str_veh));
format(temp,sizeof(temp),"`vColor2`='%d',",veh_info[vehicleid][vColor2]);strcat(str_veh,temp,sizeof(str_veh));
format(temp,sizeof(temp),"`vParked`='%d',",veh_info[vehicleid][vParked]);strcat(str_veh,temp,sizeof(str_veh));
format(temp,sizeof(temp),"`vFuel`='%d'",VehicleFuel[vehicleid]);strcat(str_veh,temp,sizeof(str_veh));
format(temp,sizeof(temp),"WHERE `vID` = '%i'",veh_info[vehicleid][vID]);strcat(str_veh,temp,sizeof(str_veh));
mysql_function_query(con_bd, str_veh, true, "", "");
printf("Автомобилей сохранено: %i", TOTALVEH);
mysql_log();
}
return 1;
}
Код:
[ERROR] CMySQLQuery::Execute[] - (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 '`vID`='0'' at line 1
Код:
public SaveVehicles()
{
new query[412];
for(new car = 0; car < MAX_VEHICLES; car++)
{
if(veh_info[car][vBuyed] == 0) continue;
mysql_format(con_bd,query,sizeof(query),"UPDATE cars SET `vModel`='%d',`vSpwnx`='%f',`vSpwny`='%f',`vSpwnz`='%f',`vSpwnf`='%f',`vPrice`='%d',`vOwner`='%s' WHERE `vID`='%i'",veh_info[car][vModel],veh_info[car][vSpwx],veh_info[car][vSpwy],veh_info[car][vSpwz],veh_info[car][vSpwf],veh_info[car][vPrice],veh_info[car][vOwner],veh_info[car][vID]);
mysql_function_query(con_bd, query, false,"","");
mysql_format(con_bd,query,sizeof(query),"UPDATE cars SET `vLocked`='%d',`vColor1`='%d',`vColor2`='%d',`vParked`='%d',`vFuel`='%d' WHERE `vID`='%i'",veh_info[car][vLocked],veh_info[car][vColor1],veh_info[car][vColor2],veh_info[car][vParked],VehicleFuel[car],veh_info[car][vID]);
mysql_function_query(con_bd, query, false,"","");
mysql_log();
}
return 1;
}
Последнее редактирование:
