Modification des données

Fermé
kami_24 Messages postés 41 Date d'inscription samedi 16 avril 2011 Statut Membre Dernière intervention 22 mai 2011 - 4 mai 2011 à 20:07
avion-f16 Messages postés 19246 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 21 avril 2024 - 4 mai 2011 à 22:02
Bonjour,

j'ai un crée un code pour modifier des données insérées dans ma base de donnée..mais rien ne se modifié..voici le code:

<?php
session_start();

$ref_no=$_SESSION['ref_no'];

<form name="remplir" method="POST" action="edit.php">
<input type=hidden name="mail_req" value=<?php echo $_SESSION['email'] ?>>
<div class="mama">
<table>

<tr><td width=20% style='font-weight: bold;'> REF NO :</td>
<td><?php echo($_SESSION['ref_no']);?></td>

<td><input type="text" name="date" value="<?php echo $_SESSION['date'];?>" class="entryfont2"></td>
</tr>
<tr>
<td width=20% style='font-weight: bold;'><span> Local currency :</span></td>
<td> <input type="text" name="inv_number" class="entryfont2" value=<?php echo $_SESSION['currency']?>></td>

<td width=20% style='font-weight: bold;'><span> Invoice number :</span></td>

<td> <input type="text" name="inv_number" class="entryfont2" value=<?php echo $_SESSION['inv_number']?>></td>


<td width=20% style='font-weight: bold;'><span> Requesting center :</span></td>

<td><input type="text" name="req_center" class="entryfont2" value=<?php echo $_SESSION['req_center']?>></td>

</tr>
<tr>

<td width=20% style='font-weight: bold;'><span> Selling company :</span></td>
<td><input type="text" name="selling_com" class="entryfont2" value=<?php echo $_SESSION['selling_com']?>> </td>

<td width=20% style='font-weight: bold;'><span> Purchasing company :</span></td>
<td><input type="text" name="purchasing_com" class="entryfont2" value=<?php echo $_SESSION['purchasing_com']?>></td>

<td width=20% style='font-weight: bold;'><span> Receiving plant/center : </span></td>
<td><input type="text" name="receive_pc" class="entryfont2" value=<?php echo $_SESSION['receive_pc']?>></td>

</tr>

<tr>
<td width=20% style='font-weight: bold;'><span> Attention of Mr : </span></td>
<td><input type="text" name="attention" class="entryfont2" value=<?php echo $_SESSION['attention']?>></td>

</tr>
<tr><input type="submit" name="valider" value="continuer" class="envoi"></tr>
</table>

<?php



if(isset($_POST['currency']))
$currency=addslashes($_POST['currency']);
else $currency='';
if(isset($_POST['inv_number']))
$inv_number=addslashes($_POST['inv_number']);
else $inv_number='';
if(isset($_POST['req_center']))
$req_center=addslashes($_POST['req_center']);
else $req_center='';
if(isset($_POST['selling_com']))
$selling_com=addslashes($_POST['selling_com']);
else $selling_com='';
if(isset($_POST['purchasing_com']))
$purchasing_com=addslashes($_POST['purchasing_com']);
else $purchasing_com='';
if(isset($_POST['receive_pc']))
$receive_pc=addslashes($_POST['receive_pc']);
else $receive_pc='';
if(isset($_POST['attention']))
$attention=addslashes($_POST['attention']);
else $attention='';
if(isset($_POST['date']))
$date=addslashes($_POST['date']);
if(isset($_POST['mail_req']))
$mail_req=addslashes($_POST['mail_req']);


mysql_connect('localhost','root','')or die('Erreur de connexion '.mysql_error());
mysql_select_db('mabase') or die('Erreur de selection '.mysql_error());

if(isset($_POST['edit']))
{

$sq="UPDATE formulaire SET inv_number='$inv_number', req_center='$req_center', selling_com='$selling_com', purchasing_com='$purchasing_com', receive_pc='$receive_pc', attention='$attention' WHERE ref_no='$ref_no'";
$rq = mysql_query($sq) or die('Erreur SQL !'.$sq.'<br>'.mysql_error()) ;
if($rq)
{echo("modification réussite");}
else
{
echo("erreur");
}
}

if(isset($_POST['delete']))

{
$sql = "DELETE FROM formulaire WHERE ref_no='$ref_no'" ;
$sql = "DELETE FROM tableau WHERE ref_no='$ref_no'" ;

//exécution de la requête:
$requete = mysql_query( $sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error()) ;
if($requete)
{
echo("La suppression à été correctement effectuée") ;
}
else
{
echo("La suppression à échouée") ;
}


}
?>

1 réponse

avion-f16 Messages postés 19246 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 21 avril 2024 4 497
4 mai 2011 à 22:02
Salut,

<?php
session_start();

$ref_no=$_SESSION['ref_no'];

<form name="remplir" method="POST" action="edit.php">
Rien qu'à voir cette partie, je n'ai pas regardé plus loin.
Merci d'utiliser la balise <code> pour conserver l'indentation (les espacements) et donc la clarté du code.
Et en recopiant ton code, ne prend pas celui de ton message précédent.

De plus, il serait bien de nous préciser l'erreur affichée s'il y en a une.
0