Jump to content

Updating the looped data


belmon

Recommended Posts

My example:

 

<FORM ACTION="edit_price.php" METHOD="POST">

<?

include "db.php";

$sql = mysql_query("select * FROM prices", $conn);

while ($rs= mysql_fetch_array($sql)){

$priceid = $rs['price_id'];

$price = $rs['price'];

 

?><input type="text" name="pprice['.$priceid.']" value="<? echo $price; ?>">

<input type="submit"> </FORM>

 

And the updating code:

 

if ($pprice) {

foreach ($ ????????)

if ($price>0) {

include "db.php";

$sql = mysql_query("UPDATE prices SET price = '$pprice' WHERE price_id = '$priceid'");

}

}

-------------------------------------

 

This code is hypothetical and completely wrong. But maybe something like this.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.