Re: [PHP] Using one submit button

2002-04-16 Thread Jennifer Downey

Do you mean something like this?

   if($update)
{
 $iprice = $price["price"];
   $query = "UPDATE {$config["prefix"]}_shop SET price = $iprice where uid =
{$session["uid"]} AND id = $id";
   $ret = mysql_query($query);
}

"Martin Towell" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> user price[] as the name
> you'll also need to pass the ids as $id[]
> so you know which one you're updating
>
> -Original Message-
> From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 17, 2002 11:51 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Using one submit button
>
>
> Hi all,
>
> I thought I was going to give php a break today but I can't it's too
> adicting.
>
> I am having a little problem with a submit button in which it is suppose
to
> update records from a form.
>
> Here is the code
>
> --
--
> 
>
>
> echo "My Locker |  href=\"myshop.php\">My Shop | My
> Items";
> echo " width=20%>Image size=2>Name size=2>Quantity size=2>Remove Item size=2>Price";
> echo "";
>
>  $query = "SELECT uid, id, name, image, type, quantity 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'];
>
>
>  echo " CELLSPACING='0'>";
>  echo "";
>  echo "$name";
>  echo " size=2>$iquantity";
>  echo " href='$PHP_SELF?id=$id&remove=yes'>X";
>  echo " value=\"\" name=\"price\" size='6'
> MAXLENGTH='8'>";
>  echo "";
>
>  echo "";
> }
> echo " Prices\">";
> echo "";
>  if($update)
> {
>  $query = "UPDATE {$config["prefix"]}_shop SET price = '$price'
> where uid = {$session["uid"]}";
>  $ret = mysql_query($query);
> }
>
>
>
> --
--
> 
>
>
>
> 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?
>
> TIA
> Jennifer
>
> --
> The sleeper has awaken
>
>
> ---
> 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


---
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




RE: [PHP] Using one submit button

2002-04-16 Thread Martin Towell

user price[] as the name
you'll also need to pass the ids as $id[]
so you know which one you're updating

-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 11:51 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Using one submit button


Hi all,

I thought I was going to give php a break today but I can't it's too
adicting.

I am having a little problem with a submit button in which it is suppose to
update records from a form.

Here is the code





echo "My Locker | My Shop | My
Items";
echo "ImageNameQuantityRemove ItemPrice";
echo "";

 $query = "SELECT uid, id, name, image, type, quantity 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'];


 echo "";
 echo "";
 echo "$name";
 echo "$iquantity";
 echo "X";
 echo "";
 echo "";

 echo "";
}
echo "";
echo "";
 if($update)
{
 $query = "UPDATE {$config["prefix"]}_shop SET price = '$price'
where uid = {$session["uid"]}";
 $ret = mysql_query($query);
}








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?

TIA
Jennifer

--
The sleeper has awaken


---
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

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