1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| <?php
try
{
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$bdd = new PDO('mysql:host=localhost;dbname=maintenance', 'root', '', $pdo_options);
}
catch (Exception $e)
{
die('Erreur : ' . $e->getMessage());
}
$index = mysql_real_escape_string(htmlspecialchars(stripcslashes($_POST["index"])));
$equipment_name = mysql_real_escape_string(htmlspecialchars(stripcslashes($_POST["equipment_name"])));
$location = mysql_real_escape_string(htmlspecialchars(stripcslashes($_POST["location"])));
$specification= mysql_real_escape_string(htmlspecialchars(stripcslashes($_POST["specification"])));
$date_of_install = mysql_real_escape_string(htmlspecialchars(stripcslashes($_POST["date_of_install"])));
$power = mysql_real_escape_string(htmlspecialchars(stripcslashes($_POST["power"])));
$time_on = mysql_real_escape_string(htmlspecialchars(stripcslashes($_POST["time_on"])));
$time_off = mysql_real_escape_string(htmlspecialchars(stripcslashes($_POST["time_off"])));
$consumption = mysql_real_escape_string(htmlspecialchars(stripcslashes($_POST["consumption"])));
$temp_use = mysql_real_escape_string(htmlspecialchars(stripcslashes($_POST["temp_use"])));
$next_intervention_date = mysql_real_escape_string(htmlspecialchars(stripcslashes($_POST["next_intervention_date"])));
$intervention_frequency = mysql_real_escape_string(htmlspecialchars(stripcslashes($_POST["intervention_frequency"])));
$sql_req= 'INSERT INTO equipment (index, equipment_name, location, specification, date_of_install, power, time_on, time_off, consumption, temp_use, next_intervention_date, intervention_frequency ) VALUES(:index, :equipment_name, :location, :specification, :date_of_install, :power, :time_on, :time_off, :consumption, :temp_use, :next_intervention_date, :intervention_frequency )';
$req=$bdd->prepare($sql_req);
$req->execute(ARRAY(
':index' => $index,
':equipment_name' => $equipment_name,
':location' => $location,
':specification' => $specification,
':date_of_install' => $date_of_install,
':power' => $power,
':time_on' => $time_on,
':time_off' => $time_off,
':consumption' => $consumption,
':temp_use' => $temp_use,
':next_intervention_date' => $next_intervention_date,
':intervention_frequency' => $intervention_frequency));
$req->closeCursor();
?> |
Partager