Page de "Suppression d'un enregistrement" ne fonct
Posté : 17 avr. 2005, 11:44
Bonjour à tous,
J'ai créé :
- une base de donnée pour mes dvd perso = bdd_dvdperso.
- une table = listedvd.
- une connexion = connexionDvdRay
- un champ (clé primaire) = titre.
J'ai déjà créé plusieurs pages php qui fonctionnent
. Mais la page de suppression d'un dvd, Suppr.php, ne fonctionne pas
. J'ai pourtant bien suivi le manuel que je viens d'acheter
.
Après la suppression, la page Liste.php doit s'ouvrir. Mais moi, rien ne se passe, il n'y a même pas de message d'erreur. Après avoir sélectionné mon dvd à supprimer dans la liste, et appuyé sur le bouton Supprimer, je reste sur ma page Suppr.php sans que le dvd n'est été supprimé.
Voici le code de ma page :
J'espère que qqln pourra me venir en aide.
Merci d'avance,
Adam
J'ai créé :
- une base de donnée pour mes dvd perso = bdd_dvdperso.
- une table = listedvd.
- une connexion = connexionDvdRay
- un champ (clé primaire) = titre.
J'ai déjà créé plusieurs pages php qui fonctionnent
Après la suppression, la page Liste.php doit s'ouvrir. Mais moi, rien ne se passe, il n'y a même pas de message d'erreur. Après avoir sélectionné mon dvd à supprimer dans la liste, et appuyé sur le bouton Supprimer, je reste sur ma page Suppr.php sans que le dvd n'est été supprimé.
Voici le code de ma page :
Code : Tout sélectionner
<?php require_once('../Connections/connexionDvdRay.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
if ((isset($_GET['titre'])) && ($_GET['titre'] != "")) {
$deleteSQL = sprintf("DELETE FROM listedvd WHERE titre=%s",
GetSQLValueString($_GET['titre'], "text"));
mysql_select_db($database_connexionDvdRay, $connexionDvdRay);
$Result1 = mysql_query($deleteSQL, $connexionDvdRay) or die(mysql_error());
$deleteGoTo = "Liste.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
mysql_select_db($database_connexionDvdRay, $connexionDvdRay);
$query_ListeDvdSuppression = "SELECT titre FROM listedvd ORDER BY titre ASC";
$ListeDvdSuppression = mysql_query($query_ListeDvdSuppression, $connexionDvdRay) or die(mysql_error());
$row_ListeDvdSuppression = mysql_fetch_assoc($ListeDvdSuppression);
$totalRows_ListeDvdSuppression = mysql_num_rows($ListeDvdSuppression);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/AccueilDvd.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Document sans titre</title>
<!-- InstanceEndEditable --><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #000000;
}
.Style8 {
color: #999999;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
}
.Style9 {
color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
.Style15 {font-size: 14px; color: #FFFFFF; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; }
.Style17 {color: #FFFFFF; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; }
-->
</style>
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.Style18 {color: #FFFF00}
-->
</style>
<style type="text/css">
<!--
.Style19 {
font-size: 12px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
-->
</style>
<!-- InstanceEndEditable -->
<link href="../DvdCdRay.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="150" height="55" rowspan="2" align="left" valign="top" scope="col"><a href="../index.php"><img src="../images/LogoDvdCd.jpg" width="150" height="55" border="0"></a></th>
<th align="center" valign="top" scope="col"><table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<th height="10" colspan="5" scope="col"></th>
</tr>
<tr align="center" valign="middle">
<td><span class="Style15"><a href="Ajout.php">Ajout</a></span></td>
<td><span class="Style17">Modif</span></td>
<td><span class="Style17"><a href="Suppr.php">Supp</a></span></td>
<td><span class="Style17"><a href="Liste.php">Liste</a></span></td>
<td><span class="Style15">Recherche</span></td>
</tr>
</table></th>
</tr>
<tr>
<th align="center" valign="bottom" scope="col"><span class="Style8">ESPACE PUBLIC</span></th>
</tr>
</table>
<br>
<!-- InstanceBeginEditable name="AccueilDvd" -->
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="col"><form action="Suppr.php" method="get" name="DVDsuppr" id="DVDsuppr">
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<th height="40" colspan="3" scope="col"><table width="190" height="25" border="0" cellpadding="0" cellspacing="0" bgcolor="#A21C1D">
<tr>
<th scope="col"><span class="Style18 Style19">SUPPRESSION D'UN DVD </span></th>
</tr>
</table></th>
</tr>
<tr>
<th height="25" align="right" scope="col"><select name="dvd" id="dvd">
<?php
do {
?>
<option value="<?php echo $row_ListeDvdSuppression['titre']?>"><?php echo $row_ListeDvdSuppression['titre']?></option>
<?php
} while ($row_ListeDvdSuppression = mysql_fetch_assoc($ListeDvdSuppression));
$rows = mysql_num_rows($ListeDvdSuppression);
if($rows > 0) {
mysql_data_seek($ListeDvdSuppression, 0);
$row_ListeDvdSuppression = mysql_fetch_assoc($ListeDvdSuppression);
}
?>
</select> </th>
<th width="50" scope="col"> </th>
<th width="230" align="left" scope="col"><input type="submit" name="Submit" value="Supprimer"></th>
</tr>
<tr>
<th height="25" colspan="3" scope="col"> </th>
</tr>
</table>
</form></th>
</tr>
</table>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($ListeDvdSuppression);
?>J'espère que qqln pourra me venir en aide.
Merci d'avance,
Adam