Hmmmm..... I might be wrong but :
> $ret = mysql_query($query); > while($row = mysql_fetch_array($ret)) > { > $user = $row['name']; > > $query = "SELECT uid, id, iname, image, quantity, type FROM {$config["prefix"]}_my_items WHERE uid={$session["uid"]} AND id = '$id' ORDER BY id"; > $ret = mysql_query($query); > while($row = mysql_fetch_array($ret)) is absolutely wrong ... the first $ret and $row is replaced by the second $ret and $row, try to change the names of one of those two pairs and give it another try. I looks to me as if one row executes the IF and another one the ELSE Statement ( try to let the script die(); after one the first while. red -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Gesendet: Dienstag, 23. April 2002 8:31 PM An: [EMAIL PROTECTED] Betreff: Re: [PHP] If else question Aeh, sorry - but is the 1 you test for actual a number or is it a string? I had made this mistakes earlier, so also try if ( $quantity == "1") Maybe I´m absolutely wrong, (PHP 3 knowledge) but.... Oliver At 23.04.2002 10:48, you wrote: >Ok you asked for it. >Don't say I didn't warn you. > >session_start(); >$query = "SELECT name FROM {$config["prefix"]}_users WHERE >uid={$session["uid"]}"; >$ret = mysql_query($query); >while($row = mysql_fetch_array($ret)) >{ >$user = $row['name']; >$query = "SELECT uid, id, iname, image, quantity, type FROM >{$config["prefix"]}_my_items WHERE uid={$session["uid"]} AND id = '$id' >ORDER BY id"; >$ret = mysql_query($query); >while($row = mysql_fetch_array($ret)) >{ > $uiid = $row['uid']; > $iid = $row['id']; > $image = $row['image']; > $iname = $row['iname']; > $quantity = $row['quantity']; > $type = $row['type']; >// this is the problem if statement. Please don't yell at me for my style. >It is easy for me to read so I'm sorry if it's not for you. >if($quantity < 1) >{ >echo "Sorry I can't seem to locate this item"; >} >else >{ >session_register("uiid"); >session_register("iid"); >session_register("image"); >session_register("iname"); >session_register("quantity"); >session_register("type"); > if($iid == $id) > { > > $display_block .="<CENTER><img src=$image border=0><br><font size = >2>$iname<BR>$quantity<BR>$type<BR></font></CENTER>"; > > echo "$display_block<BR><BR>"; > > if($type == "food") > //if the item food is present then set an option and include in the >form later > { > $thisoption="<OPTION VALUE=\"feed\">Feed my pet\n</OPTION>"; > } > else > { > //if book or weapon is present then set a blank > $thisoption=""; > } > } >} >} >} >//check if form has been submitted >if($submit) >{ > >} >else >{ > >//if the form has not been submitted run the following > > > echo "<FORM ACTION='$PHP_SELF' METHOD='post'>"; > echo "<SELECT NAME='sort' SIZE='1' >"; > echo "$thisoption"; > echo "<OPTION VALUE='shop'>Put in my shop</OPTION>"; > echo "<OPTION VALUE='locker'>Put into my Footlocker</OPTION>"; > echo "<OPTION VALUE='discard'>Discard this item</OPTION>"; > echo "<OPTION VALUE='donate'>Donate this item</OPTION>"; > echo "</SELECT>"; > echo "<INPUT TYPE='submit' VALUE='Submit' NAME='submit'>"; > echo "</FORM>"; >} >Jennifer -- 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