PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?
if ($edprice) {
foreach ($edprice as $priceid => $theprice)
if ($theprice>0) {
include "db.php";
$sql = mysql_query("UPDATE move SET price = '$theprice' WHERE price_id = '$priceid'");
}
}
?>
Any idea?
Thanks
Last edited by Benjamin on Mon Nov 07, 2011 3:23 pm, edited 1 time in total.
Reason:Added [syntax=php|sql|css|javascript] and/or [text] tags.
pickle | Please use [ syntax=php ], [ syntax=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: Posting Code in the Forums to learn how to do it too.
<?
include "db.php";
$sql = mysql_query("select * FROM price", $conn);
while ($rs= mysql_fetch_array($sql)){
$priceid = $rs['price_id'];
$price = $rs['price'];
?><TR><TD style=font-size:11px> <input type="text" name="edprice['.$priceid.']" value="<? echo $price; ?>" class="width"> </TD></TR><?
}
?>
--------------------
AND The updating code:
<?
include "db.php";
if ($edprice) {
foreach ($edprice as $priceid => $theprice)
if ($theprice>0) {
$sql = mysql_query("UPDATE price SET price = '$theprice' WHERE price_id = '$priceid'");
}
}
?>
What that happens, is simply that nothing happens, no updating.
pickle | Please use [ syntax=php ], [ syntax=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: Posting Code in the Forums to learn how to do it too.
this code is incomplete... no form declared.. table code is incomplete...no calling the other piece of code... no record id to identify the target record, etc..etc... just to start with the simplest errors... do a search and read the right way to implement a FORM... try to fix your errors and came back if in doubt