Re: If else question
| From: | heinisch at creaction dot de | Date: | Tue, 23 Apr 2002 18:30:38 +0000 |
| Subject: | Re: If else question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94227@lists.php.net to get a copy of this message | ||
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 theform 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