please i am trying to make an update in a database where changes have been made to quantity,but i need a guide where the change is update is only made to where the change is done.
this is the code where the changes would be done
<?
$pplresult = mysql_query("SELECT * FROM repplac");
echo "<table border='1'><tr><th> SHOP NAME</th><th> PRODUCT NAME</th><th>
PRODUCT SIZE</th><th> PRODUCT COLOUR</th><th> PRODUCT QUANTITY</th><th>
PRICE</th><th> </th></tr>";
while($row = mysql_fetch_assoc($pplresult)){?>
<form action='updatepplac.php' method='Post' class='slistbar'>
<?echo "<tr><td>" .$row['Sname'] ."</td><td>" .$row['Pname'] ."</td><td>" .$row['Psize'] ."</td><td>" .$row['Pcolour'] ."</td><td>" ."<input type='text' name='Pquantity' id='Pquantity' value='{$row['Pquantity']}' >" ."</td><td>" .$row['Price'] ."</td><td>" ?>
<a href="deleteproduct.php?del=<?php echo $row['Pidno'];?>">delete</a></td></tr><?php }
// table closing tag
?>
and the update script
$submit = $_POST['submit'];
$pid = $_GET['del'];
$nPquantity = $_POST['Pquantity'];
//echo "$nPquantity";
//die();
if('POST' === $_SERVER['REQUEST_METHOD'])
{
$queryreg = mysql_query("
UPDATE repplac SET Pquantity='$nPquantity' ")or die(mysql_error());
}
i KNOW I HAVE NOT SPECIFIED WHERE THE UPDATE IS TO BE DONE, WHEN I ECHOED THE QUANTITY CHANGE, IT ONLY CAME BACK, WITH RESULT WHERE THE LAST ROW WAS CHANGED AND NOT ALL WHERE CHANGES WHERE DONE, AND I DID NOT KNOW THE FUNCTION TO BRING THE POST VARIABLE BCK IN ARRAY TO CHECK THE VARIABLE RETURNED, PLEASE I NEED A GUIDE THANKS ON HOW TO MAKE UPDATE CHANGES AT THE RIGHT PLACES.THANKS