I am just completely lost on what is wrong.
I can get this code to update the first record then it will not update anything after that. Even if I try to change the price of the first record.
I get no error. would someone please show me what I have done wrong? I have been working on this now for for days and am not getting anywhere.
echo "<FORM action='$PHP_SELF' METHOD='post'>";
$query = "SELECT uid, id, name, image, quantity, type FROM {$config["prefix"]}_shop WHERE uid = {$session["uid"]}";
$ret = mysql_query($query);
while($row = mysql_fetch_array($ret))
{
$uid = $row['uid'];
//$id = $row['id'];
$name = $row['name'];
$image = $row['image'];
$quantity = $row['quantity'];
$type = $row['type'];
if(isset($update)){
for ($i=0; $i<count($id); $i++)
{
if ($id[$i] == $row['id'])
{
$query = "UPDATE {$config["prefix"]}_shop SET price = '$price[$i]' where uid = {$session["uid"]} AND id = '$id[$i]'";
$ret = mysql_query($query) or die(mysql_error());
}
}
}
else
{
echo "<TABLE BORDER='0' WIDTH='95%' CELLPADDING='0' CELLSPACING='0'><TR>";
echo "<TD width=20%><img src='$image'></TD>";
echo "<TD width=30%><font size=2>$name</font></TD>";
echo "<TD width=20%><font size=2><CENTER>$quantity</CENTER></font></TD>";
echo "<TD width=30%><font size=2><CENTER><a href='$PHP_SELF?id=$id&remove=yes'>X</a></CENTER></font></TD>";
echo "<TD width=30%><font size=2><CENTER><input=\"hidden\" name=\"id[]\" value=\"$id\">";
echo "<input type=\"text\" value=\"\" name=\"price[]\" size='8' MAXLENGTH='8'><BR></a></CENTER></font></TD>";
echo "</TD></TR></TABLE>";
echo "<input=\"hidden\" name=\"remove\" value=\"yes\">";
}
}
echo "<CENTER><INPUT TYPE=\"submit\" NAME=\"update\" VALUE=\"Updat Prices\">";
echo "</form>";
I appreciate your tiime and help.
Jennifer.