Thank you Jason and Kevin for your time and help.

Does this look like what I should have?

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 "<TD width=30%><font size=2><CENTER><input=\"hidden\"
name=\"id[$i]\" value=\"$id\"><input type=\"text\" value=\"\"
name=\"price[$i]\" size='8' MAXLENGTH='8'><BR></a></CENTER></font></TD>";

Jennifer

"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> On Thursday 18 April 2002 00:11, Jennifer Downey wrote:
> > I have no takers on this one?
> >
> > Just to let you know I have been working on this to here is some new
code.
> > What I need this to do is update the price in the db table.
> >  if I have on item it is fine. If I have two items it won't update the
> > first items price but will the second. if I try to enter a price in the
> > first items textbox it doesn't update and then deletes the second item's
> > price.
> >
> >  If I have 15 items and using one submit button how do I get this to
update
> >  all items that are listed?
> >
> > $query = "SELECT uid, id, name, image, type, quantity, price 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'];
> >    $iquantity = $row['quantity'];
> >    $itype = $row['type'];
> >    $iprice = $row['price'];
> >
> > if($update)
> > {
> >      $eprice = '$price[]';
>
> I don't know what else is wrong with your code, but this is *definitely*
> going to cause problems.
>
> I assume you mean:
>
>   $eprice = $price[];
>
> But even this is wrong. You should probably be keeping a counter, eg $i,
then
> use:
>
>   $eprice = $price[$i];
>
> [snip]
>
> > value=\"\" name=\"price[]\" size='8'
>
>   value=\"\" name=\"price[$i]\" size='8'
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> We have a equal opportunity Calculus class -- it's fully integrated.
> */


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to