No it's okay .... lots' of people post general HTML questions in here..

I love studying other people's..............code style...


You really need to work on your style I think.. No offence but it's quite
hard to read.. I had to painstakingly (thank God it was fairly small script)
space it all out and set the format all nice so it made sense.


The hardest thing in the world I think is trying to read anothers code :)


anyway after this process I finally saw where the error most possibly is
occuring.. the formatting of my style made it really easy to pick out..


ok.. I have attached it anyway.. so it should retain it's formatting.. make
sure you have wordwrap off if your using some old text editor


I strongly suggest getting a good text editor if your planning on coding a
lot.. I use TextPad 4 and I love it.. It has full code colouring, PLENTY of
features for text-searches and replacement, macros etc... multiple files..
there are so many diff. text editors out there like it, but they are much
better than Notepad once you get the hang on them... trust me :) I used to
use Notepad for around 3-4 years for all my Javascript, Java, Turbopascal,
Perl... ewwww.. terrible really.. hard to read..


anyways

yes I believe you are putting that closing brace in the right spot (as in
the spot you said it "should" work but doesn't due to the parse error) but
you unfortunately that's not where the problem lies.. You somehow have put
one TOO many closing braces further up in your code around this part:

      $thisoption="";
    }
  }
} <== one of these should be taken out


//check if form has been submitted
if($submit){


see how there's 3 closing braces?? try with two and then also put in one
where you thought you were supposed to:

  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 pars error.
} //<== This is the one you were missing..

} else {
//if the form has not been submitted run the following

?>


hope it helps.. if not please email me: [EMAIL PROTECTED] would love
to find out how it goes... what are you making anyway? some kinda virtual
creature/pet game?? sounds fun :)









:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Julien Bonastre [The-Spectrum.org CEO]
A.K.A. The_RadiX
[EMAIL PROTECTED]
ABN: 64 235 749 494
Mobile: 0407 122 268
QUT Student #: 04475739
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::



----- Original Message -----
From: "Jennifer Downey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 13, 2002 1:09 PM
Subject: [PHP] Re: Closing curly brackets?


> My apologies for putting this in the wrong list.
>
> Jennifer
>
> "Jennifer Downey" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi everyone,
> >
> > I have a question about this code. The way it sits now it always shows
the
> > last record in the 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 bracker
> > 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 =
> > 2>$name<BR>$quantity<BR>$type</font></CENTER>";
> >                     echo "$display_block<BR><BR>";
> > if($type == "food")
> > //if book or weapon is present then set an option and include in the
form
> > later
> > {$thisoption="<OPTION VALUE=\"feed\">Feed my pet\n</OPTION>";
> > }else{
> > //if any other type is present then set a blank
> > $thisoption="";}
> > }
> > }
> >
> >
> >
> > //check if form has been submitted
> > if($submit){
> >
> >    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
> > uid={$session["uid"]}";
> > $ret = mysql_query($db);
> > while(list($db)=mysql_fetch_row($ret))
> > { $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 pars error.
> > }else{
> > //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>
> > </SELECT>
> > <INPUT TYPE="submit" VALUE="Submit" NAME="submit" >
> > </FORM>
> > <?
> > }
> > //if I put the first while statement's closing curly bracket here it
works
> > great except it prints multiple dropdown lists on the page.
> >
> > I have tried the bracket in numerous places but I can't find the right
> spot.
> >
> >
> >
> >
> >
> > ---
> > 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
> >
> >
>
>
> ---
> 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

Reply via email to