http://www.bilder-upload.eu/show.php?fi ... 935359.png
malheureusement quand j'essaye de vouloir supprimer (löschen )ca na marche pas je recois cette erreur
Notice: Undefined index: id_pho in C:\xampp\htdocs\kant\supprimerProduit.php on line 4
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\'\'' at line 1' in C:\xampp\htdocs\kant\supprimerProduit.php:6 Stack trace: #0 C:\xampp\htdocs\kant\supprimerProduit.php(6): PDO->query('delete from pro...') #1 {main} thrown in C:\xampp\htdocs\kant\supprimerProduit.php on line 6
voila a quoi ressemble mon tableau produits http://www.bilder-upload.eu/show.php?fi ... 935478.png
supprimerProduit.php
<?php require_once("connection.php")?>
<?php
$ph=$_GET["id_pho"];
$req= mysql_real_escape_string("delete from produits where photo='" . $ph. "'"); //linie 4
$dbConnect->query($req) or die(mysql_error());
header("location:GestionProduits.php"); //linie 6
//$dbConnect->close()?
?>
GestionProduit.php
<?php
session_start();
require_once("connection.php");
$req= $dbConnect->query("SELECT * from categories");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Management-Produit</title>
<link rel="stylesheet" type="text/css" href="style1.css">
<script language="javascript">
function confirmation(photo){
var rep=confirm("Sind sie sicher dieses Bild zu löschen ?");
if(rep==true){
document.location="supprimerProduit.php?photo="+photo
}
}
</script>
</head>
<body>
<?php
require_once("entete.php");
?>
<div id="formProduits" align="center">
<form method="post" action="addProduit.php" enctype="multipart/form-data">
<table>
<tr>
<td>Kategorie:</td>
<td>
<select name="idCat">
<?php while($cat = $req->fetch(PDO::FETCH_ASSOC)) { ?>
<option value="<?php echo $cat["code_cat"]; ?>">
<?php echo $cat["nom_cat"]; ?>
</option>
<?php }?>
</select>
</td>
</tr>
<tr>
<td>Bild:</td><td><input type="file" name="photo"></td>
</tr>
<tr>
<td><input type="submit" value="Hinzufügen"></td>
</tr>
<?php
$req2= $dbConnect->query("SELECT photo, id_pho, code_cat from produits");
?>
<div id="listeProduits" align="center">
<table border="1">
<tr>
<th>BILD-ID</th><th>BILDPFAD</th><th></th>
</tr>
<?php while($prod = $req2->fetch(PDO::FETCH_ASSOC)){?>
<tr>
<td><?php echo($prod['id_pho'])?></td>
<!--<td><?php //echo($prod['code_cat'])?></td>-->
<td><?php echo($prod['photo'])?></td>
<td>
<a href="javascript:confirmation(<?php echo($prod['id_pho'])?>)">Löschen</a>
</td>
</tr>
<?php } ?>
</table>
</div>
</table>
</form>
</div>
</body>
</html>