Bonjour,
Je me présente, je m'appelle Gregory, proprietaire du site morava airlines . com
Je rencontre actuellement des petits soucies en ayent ajouté des champs supplementaire à mes tables de données SQL.
J'ai crée les nouveaux champs directement dans phpmyadmin.
Voici la structure SQL de ma table :
CREATE TABLE IF NOT EXISTS {$dbprefix}Aircraft
(
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ICAO` text,
`Name` text,
`Pax` int(11) DEFAULT NULL,
`Cargo` int(11) DEFAULT NULL,
`URL` text,
`ImageURL` text,
`ACRange` int(11) DEFAULT NULL,
`Cruise` int(11) DEFAULT NULL,
`Cruisingspeed` int(11) DEFAULT NULL,
`Maximumspeed` int(11) DEFAULT NULL,
`Engines` text,
`Sizelength` float DEFAULT NULL,
`Sizewidth` float DEFAULT NULL,
`Sizeheight` float DEFAULT NULL,
`MTOW` int(11) DEFAULT NULL,
`RequiredrunwayatMTOW` int(11) DEFAULT NULL,
`Fuelcapacity` int(11) DEFAULT NULL,
`FuelConsumptionhourly` double DEFAULT NULL,
`Unitcost` text,
`Parkingcostmonthly` int(11) DEFAULT NULL,
`Operatingcosthourly` int(11) DEFAULT NULL,
`Fuelcosthourly` int(11) DEFAULT NULL,
`Totalhourlycost` int(11) DEFAULT NULL,
`Waketurbcat` text,
`Introductionsince` date DEFAULT NULL,
`minrank` int(11) NOT NULL DEFAULT '0',
`ranklevel` int(11) NOT NULL DEFAULT '0',
`enabled` smallint(6) NOT NULL DEFAULT '1',
PRIMARY KEY (`ID`),
KEY `ACRange` (`ACRange`)
)")) echo mysql_error()." at line ".__LINE__." in ".__FILE__;
A partir de "cruise" inclu jusqu'à enabled, ce sont les nouveaux champs.
Depuis la création de ces champs, à chaque fois que je fait un update ou un insere, je recoit le message suivant :
You have an error in your SQL syntax, check the manual that corresponds to you MySQL server version for the right syntax to use near 'M, parkingcostmonthly='19222', Operatingcosthourly='29009', Fuelcosthourly='181' at line 1.
Je crois que la faute se trouve dans ce fichier php que j'ai modifié :
<?php
if ($action == "fleetsettings")
{
$sets = array("checkrange", "checkdep");
for ($i=0;$i<count($sets);$i++)
{
$var = $sets[$i];
if (isset($_POST[$var]))
{
$val = $_POST[$var];
SetSetting($var, $val);
}
}
}
if ($action == "addactype")
{
$icao = substr(strtoupper($_POST["icao"]), 0, 4);
$name = $_POST["name"];
$pax = $_POST["pax"];
$cargo = $_POST["cargo"];
$url = $_POST["url"];
$imageurl = $_POST["imageurl"];
$range = $_POST["range"];
$id = $_POST["ID"];
$Waketurbcat = $_POST["Waketurbcat"];
$Sizelength = $_POST["Sizelength"];
$Sizewidth = $_POST["Sizewidth"];
$Sizeheight = $_POST["Sizeheight"];
$Parkingcostmonthly = $_POST["Parkingcostmonthly"];
$Cruise = $_POST["Cruise"];
$Fuelcapacity = $_POST["Fuelcapacity"];
$FuelConsumptionhourly = $_POST["FuelConsumptionhourly"];
$Operatingcosthourly = $_POST["Operatingcosthourly"];
$Engines = $_POST["Engines"];
$Fuelcosthourly = $_POST["Fuelcosthourly"];
$Maximumspeed = $_POST["Maximumspeed"];
$Totalhourlycost = $_POST["Totalhourlycost"];
$Cruisingspeed = $_POST["Cruisingspeed"];
$Unitcost = $_POST["Unitcost"];
$MTOW = $_POST["MTOW"];
$Introductionsince = $_POST["Introductionsince"];
$RequiredrunwayatMTOW = $_POST["RequiredrunwayatMTOW"];
if ($name != "" && $icao != "" && $Engines != "" && $Introductionsince != "" && $Waketurbcat != "" && is_numeric($pax) && is_numeric($cargo) && is_numeric($range) && is_numeric($Sizelength) && is_numeric($Sizewidth) && is_numeric($Sizeheight) && is_numeric($Sizewidth) && is_numeric($Parkingcostmonthly) && is_numeric($Cruise) && is_numeric($Fuelcapacity) && is_numeric($FuelConsumptionhourly) && is_numeric($Operatingcosthourly) && is_numeric($Fuelcosthourly) && is_numeric($Maximumspeed) && is_numeric($Totalhourlycost) && is_numeric($Cruisingspeed) && is_numeric($Unitcost) && is_numeric($MTOW) && is_numeric($RequiredrunwayatMTOW))
{
$sql = "INSERT INTO {$dbprefix}Aircraft (ICAO, Name, Pax, Cargo, URL, ImageURL, ACRange, Cruise, Cruisingspeed, Maximumspeed, Engines, Sizelength, Sizewidth, Sizeheight, MTOW, RequiredrunwayatMTOW, Fuelcapacity, FuelConsumptionhourly, Unitcost, Parkingcostmonthly, Operatingcosthourly, Fuelcosthourly, Totalhourlycost, Waketurbcat, Introductionsince )
VALUES ('$icao', '$name', '$pax', '$cargo', '$url', '$imageurl', '$range', '$Cruise', '$Cruisingspeed', '$Maximumspeed', '$Engines', '$Sizelength', '$Sizewidth', '$Sizeheight', '$MTOW', '$RequiredrunwayatMTOW', '$Fuelcapacity', '$FuelConsumptionhourly', '$Unitcost', '$Parkingcostmonthly' '$Operatingcosthourly', '$Fuelcosthourly', '$Totalhourlycost', '$Waketurbcat', '$Introductionince')";
mysql_query($sql);
}
}
if ($action == "editactype")
{
$thisurl = $_SERVER['HTTP_REFERER'];
$thisurl = str_replace("&editcid=$id", "", $thisurl);
if ($id != "")
{
$icao = substr(strtoupper($_POST["icao"]), 0, 4);
$name = $_POST["name"];
$pax = $_POST["pax"];
$cargo = $_POST["cargo"];
$url = $_POST["url"];
$imageurl = $_POST["imageurl"];
$range = $_POST["range"];
$id = $_POST["ID"];
$Waketurbcat = $_POST["Waketurbcat"];
$Sizelength = $_POST["Sizelength"];
$Sizewidth = $_POST["Sizewidth"];
$Sizeheight = $_POST["Sizeheight"];
$Parkingcostmonthly = $_POST["Parkingcostmonthly"];
$Cruise = $_POST["Cruise"];
$Fuelcapacity = $_POST["Fuelcapacity"];
$FuelConsumptionhourly = $_POST["FuelConsumptionhourly"];
$Operatingcosthourly = $_POST["Operatingcosthourly"];
$Engines = $_POST["Engines"];
$Fuelcosthourly = $_POST["Fuelcosthourly"];
$Maximumspeed = $_POST["Maximumspeed"];
$Totalhourlycost = $_POST["Totalhourlycost"];
$Cruisingspeed = $_POST["Cruisingspeed"];
$Unitcost = $_POST["Unitcost"];
$MTOW = $_POST["MTOW"];
$Introductionsince = $_POST["Introductionsince"];
$RequiredrunwayatMTOW = $_POST["RequiredrunwayatMTOW"];
if ($name != "" && $icao != "" && $Engines != "" && $Introduction_since != "" && $Unitcost != "" && $Waketurbcat != "" && is_numeric($pax) && is_numeric($cargo) && is_numeric($range) && is_numeric($Sizelength) && is_numeric($Sizewidth) && is_numeric($Sizeheight) && is_numeric($Sizewidth) && is_numeric($Parkingcostmonthly) && is_numeric($Cruise) && is_numeric($Fuel_capacity) && is_numeric($FuelConsumptionhourly) && is_numeric($Operatingcosthourly) && is_numeric($Fuelcosthourly) && is_numeric($Maximumspeed) && is_numeric($Totalhourlycost) && is_numeric($Cruisingspeed) && is_numeric($MTOW) && is_numeric($RequiredrunwayatMTOW))
{
$sql = "UPDATE {$dbprefix}Aircraft SET ICAO='$icao', Name='$name', Pax='$pax', Cargo='$cargo', URL='$url', ImageURL='$imageurl', ACRange='$range', Cruise='$Cruise', Cruisingspeed='$Cruisingspeed', Maximumspeed='$Maximumspeed', Engines='$Engines', Sizelength='$Sizelength', Sizewidth='$Sizewidth', Sizeheight='$Sizeheight', MTOW='$MTOW', RequiredrunwayatMTOW='$RequiredrunwayatMTOW', Fuelcapacity='$Fuelcapacity', FuelConsumptionhourly='$FuelConsumptionhourly', Unitcost='$Unitcost', Parkingcostmonthly='$Parkingcostmonthly', Operatingcosthourly='$Operatingcosthourly', Fuelcosthourly='$Fuelcosthourly', Totalhourlycost='$Totalhourlycost', Waketurbcat='$Waketurbcat', Introductionsince='$Introductionsince' WHERE ID=$id";
mysql_query($sql);
}
}
}
if ($action == "deleteactype")
{
if ($id != "")
{
$sql = "DELETE FROM {$dbprefix}Aircraft WHERE ID=$id";
mysql_query($sql);
}
}
if ($action == "addac")
{
$reg = substr(strtoupper($_POST["reg"]), 0, 7);
$icao = strtoupper($_POST["icao"]);
$acid = $_POST["actype"];
if ($reg != "" && $acid != "")
{
$_SESSION["addacid"] = $acid;
$sql = "INSERT INTO {$dbprefix}Fleet (ACID, Reg, ICAO) VALUES ('$acid', '$reg', '$icao')";
mysql_query($sql);
}
}
if ($action == "editac")
{
$thisurl = $_SERVER['HTTP_REFERER'];
$thisurl = str_replace("&editid=$id", "", $thisurl);
if ($id != "")
{
$reg = substr(strtoupper($_POST["reg"]), 0, 7);
$icao = strtoupper($_POST["icao"]);
$acid = $_POST["actype"];
$sql = "UPDATE {$dbprefix}Fleet SET ACID='$acid', Reg='$reg', ICAO='$icao' WHERE ID=$id";
mysql_query($sql);
}
}
if ($action == "deleteac")
{
if ($id != "")
{
$sql = "DELETE FROM {$dbprefix}Fleet WHERE ID=$id";
mysql_query($sql);
}
}
?>
Si quelqu'un d'aimable, pourrais me dire ou se situe l'erreur et comment la corriger, ca serait superbe !!
Bonne nuit à vous tous,
Greg