Hi everyone,

I originally posted this in general by mistake.

I have a question about this code. The way it sits now it always shows the
last record in the database table.
In other words if the user has 6 items, like:
item id 1
item id 2
item id 5
item id 6
item id 7
item id 8

it will only show the last record item id 8.

I believe it has something to do with the first while statement's closing
curly bracket placement
but I can't seem to get it in the right place.

Can someone spot the mistake and show me how to fix it.
see also comments in code.

$id = $HTTP_GET_VARS["id"];

$query = "SELECT id, name, image, quantity, type FROM
{$config["prefix"]}_my_items WHERE uid={$session["uid"]} ORDER BY id";
$ret = mysql_query($query);
         while($row = mysql_fetch_array($ret))
$iid = $row['id'];
$image = $row['image'];
$name = $row['name'];
$quantity = $row['quantity'];
$type = $row['type'];

            if($iid == $id)
$display_block ="<CENTER><img src=$image border=0><br><font size =
                    echo "$display_block<BR><BR>";
if($type == "food")
//if book or weapon is present then set an option and include in the form
{$thisoption="<OPTION VALUE=\"feed\">Feed my pet\n</OPTION>";
//if any other type is present then set a blank

//check if form has been submitted

   if($sort == 'shop')
         echo "This item has been taken care of<BR>";

// We are selecting user id to insert into the users items.
$db="SELECT  uid FROM {$config["prefix"]}_users WHERE
$ret = mysql_query($db);
{ $user = $db;
echo "Your user ID is $user<BR>";

echo "You have $quantity of this item and it's id is $iid<BR>";

// it seems like the first while statement's closing curly bracket should go
//here but if I put it here I get a parse error.
//if the form has not been submitted run the following

<FORM ACTION="<?echo"$PHP_SELF";?>" METHOD="post">
<SELECT NAME="sort" SIZE=1 >
<?echo "$thisoption";?>
<OPTION VALUE="shop">Put in my shop</OPTION>
<OPTION VALUE="locker">Put into my Footlocker</OPTION>
<OPTION VALUE="discard">Discard this item</OPTION>
<OPTION VALUE="donate">Donate this item</OPTION>
<INPUT TYPE="submit" VALUE="Submit" NAME="submit" >
//if I put the first while statement's closing curly bracket here it works
except it prints multiple dropdown lists on the page and only prints the
first item id 1.

I have tried the bracket in numerous places but I can't find the right spot.

Thanks in advance

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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to