diff --git a/.gitignore b/.gitignore
index 03c4c38..9a5ad6d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
config/config.php
+config/conf.php
.idea
/public/uploads
/tmp
diff --git a/config/conf.php b/config/conf.php
index 32e0b2d..b8c7df8 100644
--- a/config/conf.php
+++ b/config/conf.php
@@ -1,5 +1,7 @@
prepare($req_search);
- //$antenne_id = $stmt->execute($params1);
-
// Récupération des informations du formulaire
$params = array();
$params['name'] = $params['slug'] = $_POST['produit'];
@@ -25,8 +19,6 @@ ini_set('display_errors', 0);
$params['content'] = '';
// Insertion dans la base
- /*$requete = "INSERT INTO products(name, user_id, quantite, prix, created_at, antenne_id)
- VALUES(':nom_produit', ':vendeur', ':quantite', :prix, ':created_at', ':antenne_id')";*/
$fields = array_keys($params);
$values = join(', ', array_map(function ($field) {
diff --git a/public/ajax/addRecord2.php b/public/ajax/addRecord2.php
index 88deb2a..5e886d9 100644
--- a/public/ajax/addRecord2.php
+++ b/public/ajax/addRecord2.php
@@ -11,12 +11,7 @@
$cle_pub_r = $_POST['cle_pub_r'];
$prix_r = $_POST['prix_r'];
- $query = "INSERT INTO recherches(produit, vendeur, cle_pub, prix) VALUES('$produit_r', '$vendeur_r', '$cle_pub_r', $prix_r)";
- //echo "Query = ".$query."////";
- //exit;
- if (!$result = mysqli_query($db,$query)) {
- exit(mysqli_connect_error());
- }
- echo "1 enregistrement ajouté !";
+ $query = "INSERT INTO souhaits(produit, vendeur, cle_pub, prix) VALUES('$produit_r', '$vendeur_r', '$cle_pub_r', $prix_r)";
+
}
?>
diff --git a/public/ajax/readRecherchesDetails.php b/public/ajax/readRecherchesDetails.php
index a9f1d4e..e5358cf 100644
--- a/public/ajax/readRecherchesDetails.php
+++ b/public/ajax/readRecherchesDetails.php
@@ -1,34 +1,32 @@
0) {
- while ($row = mysqli_fetch_assoc($result)) {
- $response = $row;
- }
- }
- else
- {
+try {
+
+ $bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password);
+ if (isset($_POST['id_r']) && isset($_POST['id_r']) != "") {
+
+ $souhait_id = $_POST['id_r'];
+ $params["souhait_id"] = $souhait_id;
+
+ $requete = "SELECT souhaits.*, users.username
+ FROM souhaits
+ LEFT JOIN users
+ ON users.id = souhaits.user_id
+ WHERE souhaits.id = :souhait_id";
+ $query = $bdd->prepare($requete);
+ $query->execute($params);
+ $results = array();
+ while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
+ $results = $row;
+ };
+ echo json_encode($results);
+ } else {
$response['status'] = 200;
- $response['message'] = "Data not found!";
+ $response['message'] = "Invalid Request!";
}
- // display JSON data
- echo json_encode($response);
-}
-else
-{
- $response['status'] = 200;
- $response['message'] = "Invalid Request!";
+} catch (PDOException $e) {
+ echo "Erreur : " . $e->getMessage() . "
";
}
+
diff --git a/public/ajax/readRecords2.php b/public/ajax/readRecords2.php
index e6503ce..45f48a9 100644
--- a/public/ajax/readRecords2.php
+++ b/public/ajax/readRecords2.php
@@ -1,54 +1,94 @@
+$bdd = new \PDO("mysql:host=$host;dbname=$database_name", $username, $password);
+
+// Design initial table header
+$data = '
+ $number | ";
- echo $data;
+ $data .= ''.$row['name'].' | ';
+ $data .= ' | ';
+ $data .= ''.$row['username'].' | ';
+ $data .= ' | ';
+ $data .= ''.$row['quantite'].' | ';
+ $data .= ''.$row['prix'].' | ';
+ $data .= '';
+ $data .= ' |