Re: Closing curly brackets?
| From: | Marius Ursache | Date: | Mon, 15 Apr 2002 05:19:14 +0000 |
| Subject: | Re: Closing curly brackets? | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18503@lists.php.net to get a copy of this message | ||
a good tutorial for code formating is "c and c++ style guides"
( http://www.cs.umd.edu/users/cml/cstyle/ )
a good code editor is vim (http://www.vim.org).
Jennifer Downey a écrit :
> Thank you Paul,
>
> I have asked about atutorial on proper code formatting and got back a
> tutorial that was extremely hard to understand. While lots of people have
> screamed at me for my coding format no one has supplied an understandable
> answer. That is until this morning.
>
> > The first thing you should do is properly indent your code. If you do so,
> > you'll be sure to find the missing bracket. Basically, for each new
> block,
> > tab out again.
>
> Thought that was the best tutorial I could ever get. Short and sweet and oh
> so easy to understand.
> I am using HTML_Kit as it has the same features as all the othere editors
> (color coding and such) but it also has a lot more. I can get plugins for
> anything I would ever need. Except a formatting tutorial ;)
>
> Thank for your help
> Jennifer
>
> "Paul Burney" <paul.lists@burney.ws> wrote in message
> news:B8DDC238.5D32%paul.lists@burney.ws...
> > on 4/12/02 11:15 PM, Jennifer Downey at jendowney@attbi.com appended the
> > following bits to my mbox:
> >
> > > 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.
> >
> > Hi Jennifer,
> >
> > The first thing you should do is properly indent your code. If you do so,
> > you'll be sure to find the missing bracket. Basically, for each new
> block,
> > tab out again. It really helps to use a programmer's editor with syntax
> > highlighting like vim or BBEdit. Here's an example using your 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="";}
> >
> > } // end option "if" statement
> >
> > } // end id "if" statement
> >
> > /* More code after this point */
> >
> > } // end "while" if statement.
> >
> >
> > =======================================================================
> >
> > Hope that helps.
> >
> > Sincerely,
> >
> > Paul Burney
> > <http://paulburney.com/>
> >
> > <?php
> > while ($self != "asleep") {
> > $sheep_count++;
> > }
> > ?>
> >
> >
>
> ---
> 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
--
Marius Ursache (3563 || 3494)
\|/ ____ \|/
"@'/ ,. \`@"
/_| \__/ |_\
\__U_/