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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
| $query=$db->prepare('SELECT jeu_neuf,console_neuf,manga_neuf,figurine_neuf,dvd_neuf,
prix_jeu_neuf,prix_console_neuf,prix_manga_neuf,prix_figurine_neuf,prix_dvd_neuf,
stock_jeu_neuf,stock_console_neuf,stock_manga_neuf,stock_figurine_neuf,stock_dvd_neuf
FROM magasin
WHERE prix_console_neuf = :prix_console_neuf
');
$query->bindValue(':prix_console_neuf',$prix_console_neuf, PDO::PARAM_STR);
$query->execute() or die(print_r($query->errorInfo()));
$data=$query->fetch();
print_r($data);
print("\n");;
if (
$data['prix_jeu_neuf']!=$_POST['prix_jeu_neuf']
AND $data['prix_console_neuf']!= $_POST['prix_console_neuf']
AND $data['prix_manga_neuf']!= $_POST['prix_manga_neuf']
AND $data['prix_figurine_neuf']!= $_POST['prix_figurine_neuf']
AND $data['prix_dvd_neuf']!= $_POST['prix_dvd_neuf']
AND $data['stock_jeu_neuf']!= $_POST['stock_jeu_neuf']
AND $data['stock_console_neuf']!= $_POST['stock_console_neuf']
AND $data['stock_manga_neuf']!= $_POST['stock_manga_neuf']
AND $data['stock_figurine_neuf']!= $_POST['stock_figurine_neuf']
AND $data['stock_dvd_neuf']!= $_POST['stock_dvd_neuf'])
{
$query = $db->prepare('UPDATE magasin
SET
jeu_neuf = :jeu_neuf,
console_neuf = :console_neuf,
manga_neuf = :manga_neuf,
figurine_neuf =:figurine_neuf,
dvd_neuf = :dvd_neuf,
prix_jeu_neuf = :prix_jeu_neuf,
prix_console_neuf = :prix_console_neuf,
prix_manga_neuf = :prix_manga_neuf,
prix_figurine_neuf =:prix_figurine_neuf,
prix_dvd_neuf = :prix_dvd_neuf,
stock_jeu_neuf = :stock_jeu_neuf,
stock_console_neuf = :stock_console_neuf,
stock_manga_neuf = :stock_manga_neuf,
stock_figurine_neuf = :stock_figurine_neuf,
stock_dvd_neuf = :stock_dvd_neuf
WHERE console_neuf = :console_neuf
');
$query->bindvalue(':console_neuf', $console_neuf, pdo::PARAM_STR);
$query->bindvalue(':jeu_neuf', $jeu_neuf, pdo::PARAM_STR);
$query->bindvalue(':console_neuf', $console_neuf, pdo::PARAM_STR);
$query->bindvalue(':manga_neuf', $manga_neuf, pdo::PARAM_STR);
$query->bindvalue(':figurine_neuf', $figurine_neuf, pdo::PARAM_STR);
$query->bindvalue(':dvd_neuf', $dvd_neuf, pdo::PARAM_STR);
$query->bindvalue(':prix_jeu_neuf', $prix_jeu_neuf, pdo::PARAM_STR);
$query->bindvalue(':prix_console_neuf', $prix_console_neuf, pdo::PARAM_STR);
$query->bindvalue(':prix_manga_neuf', $prix_manga_neuf, pdo::PARAM_STR);
$query->bindvalue(':prix_figurine_neuf', $prix_figurine_neuf, pdo::PARAM_STR);
$query->bindvalue(':prix_dvd_neuf', $prix_dvd_neuf, pdo::PARAM_STR);
$query->bindvalue(':stock_jeu_neuf', $stock_jeu_neuf, pdo::PARAM_STR);
$query->bindvalue(':stock_console_neuf', $stock_console_neuf, pdo::PARAM_STR);
$query->bindvalue(':stock_manga_neuf', $stock_manga_neuf, pdo::PARAM_STR);
$query->bindvalue(':stock_figurine_neuf', $stock_figurine_neuf, pdo::PARAM_STR);
$query->bindvalue(':stock_dvd_neuf', $prix_dvd_neuf, pdo::PARAM_STR);
$query->execute() or die(print_r($db->errorinfo()));
}else{
$query=$db->prepare('INSERT INTO magasin
(jeu_neuf,console_neuf,manga_neuf,figurine_neuf,dvd_neuf,image,
prix_jeu_neuf,prix_console_neuf,prix_manga_neuf,prix_figurine_neuf,prix_dvd_neuf,
stock_jeu_neuf,stock_console_neuf,stock_manga_neuf,stock_figurine_neuf,stock_dvd_neuf)
VALUES (:jeu_neuf,:console_neuf,:manga_neuf,:figurine_neuf,:dvd_neuf,:nomimage,
:prix_jeu_neuf,:prix_console_neuf,:prix_manga_neuf,:prix_figurine_neuf,:prix_dvd_neuf,
:stock_jeu_neuf,:stock_console_neuf,:stock_manga_neuf,:stock_figurine_neuf,:stock_dvd_neuf
)');
$query->bindValue(':jeu_neuf', $jeu_neuf, PDO::PARAM_STR);
$query->bindValue(':console_neuf', $console_neuf, PDO::PARAM_STR);
$query->bindValue(':manga_neuf', $manga_neuf, PDO::PARAM_STR);
$query->bindValue(':figurine_neuf', $figurine_neuf, PDO::PARAM_STR);
$query->bindValue(':dvd_neuf', $dvd_neuf, PDO::PARAM_STR);
$query->bindValue(':prix_jeu_neuf', $prix_jeu_neuf, PDO::PARAM_INT);
$query->bindValue(':prix_console_neuf', $prix_console_neuf, PDO::PARAM_INT);
$query->bindValue(':prix_manga_neuf', $prix_manga_neuf, PDO::PARAM_INT);
$query->bindValue(':prix_figurine_neuf', $prix_figurine_neuf, PDO::PARAM_INT);
$query->bindValue(':prix_dvd_neuf', $prix_dvd_neuf, PDO::PARAM_INT);
$query->bindValue(':stock_jeu_neuf', $stock_jeu_neuf, PDO::PARAM_INT);
$query->bindValue(':stock_console_neuf', $stock_console_neuf, PDO::PARAM_INT);
$query->bindValue(':stock_manga_neuf', $stock_manga_neuf, PDO::PARAM_INT);
$query->bindValue(':stock_figurine_neuf', $stock_figurine_neuf, PDO::PARAM_INT);
$query->bindValue(':stock_dvd_neuf', $stock_dvd_neuf, PDO::PARAM_INT);
$query->bindValue(':nomimage', $nomimage, PDO::PARAM_STR);
$query->execute()or die(print_r($query->errorInfo()));
$query->CloseCursor();
} |
Partager