halifaxer
05-31-2008, 02:42 AM
I have the following:
$qryTotal=mysql_query("SELECT * FROM admin WHERE dataID='911' AND inStock='yes' AND RRP=dataP ORDER BY brand,name")or
die(mysql_error());
$numrow=mysql_num_rows($qryTotal);
while($row = mysql_fetch_array( $qryTotal )) {
echo '<form method="post">';
echo $row[sku]." ".$row[brand]." ".$row[name]." <a href='".$row[dataLink]."' target='_new'>Link</a>";
echo '<input name="RRP">';
echo '<input type="submit">';
echo '</form>';
$dataLink=$row[dataLink];
$sku=$row[sku];
mysql_query("UPDATE admin SET RRP_test = '$_POST[RRP]' WHERE dataLink='$dataLink' AND sku='$sku'");
}
however it's updating every row within the query, not just the intended one. before you tell me off, yes it is neccessary for it to be contained within an output loop as only certain entries in my database require updating. and sku and dataLink are specific and individual, so i'm confused...
all help graciously received :D
$qryTotal=mysql_query("SELECT * FROM admin WHERE dataID='911' AND inStock='yes' AND RRP=dataP ORDER BY brand,name")or
die(mysql_error());
$numrow=mysql_num_rows($qryTotal);
while($row = mysql_fetch_array( $qryTotal )) {
echo '<form method="post">';
echo $row[sku]." ".$row[brand]." ".$row[name]." <a href='".$row[dataLink]."' target='_new'>Link</a>";
echo '<input name="RRP">';
echo '<input type="submit">';
echo '</form>';
$dataLink=$row[dataLink];
$sku=$row[sku];
mysql_query("UPDATE admin SET RRP_test = '$_POST[RRP]' WHERE dataLink='$dataLink' AND sku='$sku'");
}
however it's updating every row within the query, not just the intended one. before you tell me off, yes it is neccessary for it to be contained within an output loop as only certain entries in my database require updating. and sku and dataLink are specific and individual, so i'm confused...
all help graciously received :D