Bonjour,

Je souhaites updater une table, mais voilà je dois faire un update en tenant compte du "Transaction_ID" et de la "Category".
Le code ci-dessous affiche bien ma table mais ne modifie rien, pourriez vous m'orienter. Merci par avance

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
//Query
$affiche= "SELECT * FROM Details ORDER BY Category ASC";
//Execution Query
$res=mysql_query($affiche);		
while($li=mysql_fetch_assoc($res)){		
echo "<tr>
<td name='txtcategory'>".$li['Category']."</td>
<td name='txtvalue'><input class='norm' size='10' name='txtvalue' value=".$li['Value']."></td>
</tr>";
}
//Update Query
$sql = "UPDATE `details` SET   `Value` =  '{$_POST['txtvalue']}' 
WHERE `Transaction_ID` = '1' AND `Category` = '{$_POST['txtcat']}' "; 				
mysql_query($sql) or die(mysql_error()); 
echo (mysql_affected_rows()) ? "Modifications effectuees.<br />" : "Aucune modification n'a ete enregistree <br />";
?>