Modification qui marche pas

kami_24 Messages postés 46 Statut Membre -  
kami_24 Messages postés 46 Statut Membre -
Bonjour,

j'aimerai afficher les données récupéré d'une base de donnés dans un tableau
puis j'aimerai modifier ces données
voici le code que j'ai crée:

 <form name="remplir"  method="POST"  action="update.php">

  $c=mysql_query('SELECT * FROM tableau WHERE ref_no="'.mysql_escape_string($_SESSION['ref_no']).'" ');
	  $total=mysql_num_rows($c);
	if($total){
	?>
	 <table border=1 bordercolor=#AAAAAA>
	<?php
	echo'<tr align=center class=itemfont bgcolor="#EEEEEE">
<TD colspan=5 style="font-weight: bold;">assets identification</TD> 
<TD colspan=4 style="font-weight: bold;">currency ratio</TD> 
</TR> ';
   echo'<TR align=center class=itemfont bgcolor="#EEEEEE">
	  <td width=20% style="font-weight: bold;">asset_no</TD>
	  <TD width=20% style="font-weight: bold;">description</TD>
	  <TD width=20% style="font-weight: bold;">serial_number</TD>
	  <TD width=20% style="font-weight: bold;">code_alpha</TD>
      <TD width=20% style="font-weight: bold;"> aquisition</TD>
      <TD width=20% style="font-weight: bold;">original_cost</TD>
      <TD width=20% style="font-weight: bold;">depreciation</TD>
      <TD width=20% style="font-weight: bold;">local_curr</TD>
	  <TD width=20% style="font-weight: bold;">invoicing_curr</TD>
	  </tr>';  
	while($row= mysql_fetch_array($c)){
	 echo'<TR align=center class=itemfont bgcolor="#EEEEEE">
<TD><input type="text" name="asset_no" value="'.$row['asset_no'].'" class="entryfont2" maxlength=20></TD>
<TD><input type="text" name="description" value="'.$row['description'].'" class="entryfont2" maxlength=20></TD> 
<TD><input type="text" name="serial_number" value="'.$row['serial_number'].'" class="entryfont2" maxlength=20></TD>
<TD><input type="text" name="code_alpha" value="'.$row['code_alpha'].'" class="entryfont2" maxlength=20></TD>
<TD><input type="text" name="aquisition" value="'.$row['aquisition'].'" class="entryfont2" maxlength=20></TD>
<TD><input type="text" name="original_cost" value="'.$row['original_cost'].'" class="entryfont2" maxlength=20></TD>
<TD><input type="text" name="depreciation" value="'.$row['depreciation'].'" class="entryfont2" maxlength=20></TD>
<TD><input type="text" name="local_curr" value="'.$row['local_curr'].'" class="entryfont2" maxlength=20></TD>
<TD><input type="text" name="invoicing_curr" value="'.$row['invoicing_curr'].'" class="entryfont2" maxlength=20></TD>
</TR>';}



et voici comment j'ai essayé de les modifier mais ça marche pas:

if(!empty($asset_no)){
 $s1="UPDATE tableau SET asset_no='$asset_no', serial_number='$serial_number', code_alpha='$code_alpha', aquisition='$aquisition', original_cost='$original_cost' WHERE ref_no='$ref_no'";
 $r = mysql_query($sq) or die('Erreur SQL !'.$s1.'<br>'.mysql_error()) ;
}

if(!empty($asset_no1)){
 $s2="UPDATE tableau SET asset_no1='$asset_no1', serial_number1='$serial_number1', code_alpha1='$code_alpha1', aquisition1='$aquisition1', original_cost1='$original_cost1',depreciation1='$depreciation1',local_curr='$local_curr',invoicing_curr1='$invoicing_curr1' WHERE ref_no=$ref_no";
 $r = mysql_query($sq) or die('Erreur SQL !'.$s2.'<br>'.mysql_error()) ;
}
if(!empty($asset_no2)){
 $s3="UPDATE tableau SET asset_no2='$asset_no2',description2='$description2', serial_number2='$serial_number2', code_alpha2='$code_alpha2', aquisition2='$aquisition2', original_cost2='$original_cost2' WHERE ref_no=$ref_no";
 $r = mysql_query($sq) or die('Erreur SQL !'.$s3.'<br>'.mysql_error()) ;

A voir également:

1 réponse

kami_24 Messages postés 46 Statut Membre
 
vous n'avez pas de réponses??..c urgent..
0