WIP: tout ok sauf btn 'creer un ordre'
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/db.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
try {
|
||||
$db = (new App\Database\Database())->getConnection();
|
||||
|
||||
$sql = "UPDATE ordreGF_pied SET
|
||||
Date_op = :date,
|
||||
Quantite = :qte,
|
||||
Prix_brut = :prix,
|
||||
Frais_brocker = :f_b,
|
||||
Frais_etat = :f_e,
|
||||
Frais_autre = :f_a,
|
||||
Ordre = :ordre
|
||||
WHERE Id = :id";
|
||||
|
||||
$stmt = $db->prepare($sql);
|
||||
$stmt->execute([
|
||||
':date' => $_POST['Date_op'],
|
||||
':qte' => $_POST['Quantite'],
|
||||
':prix' => $_POST['Prix_brut'],
|
||||
':f_b' => $_POST['Frais_brocker'],
|
||||
':f_e' => $_POST['Frais_etat'],
|
||||
':f_a' => $_POST['Frais_autre'],
|
||||
':ordre' => $_POST['Ordre'],
|
||||
':id' => $_POST['id']
|
||||
]);
|
||||
|
||||
echo json_encode(['success' => true]);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'message' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user