Re: Loop issues
| From: | Dan Shirah | Date: | Mon, 19 Nov 2007 18:32:24 +0000 |
| Subject: | Re: Loop issues | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-264790@lists.php.net to get a copy of this message | ||
FANTASIC!
Worked like a champ!
Thank you to everyone.
On 11/19/07, Philip Thompson <philthathril@gmail.com> wrote:
>
> On Nov 19, 2007 12:16 PM, Dan Shirah <mrsquash2@gmail.com> wrote:
>
> > Jim,
> >
> > I used your suggestion and modified it a little bit. All of the names
> are
> > pulled from the database, but for some reason once it has pulled all the
> > names form each query it is adding an empty result to the end.
> >
> > So when I do a echo $row['first_name']."
> > ".$row['last_name']."<br />\n";
> > it
> > is returning something like this:
> >
> > John Smith
> > Bob Smith
> >
> > Jane Smith
> > Robert Smith
> >
> > The gap between the names contains a single space " ". I tried to trim
> > the
> > results but cannot get rid of it.
> >
> > Any ideas?
>
>
>
> Run a test condition before displaying:
>
> <?php
> $first = trim ($row['first_name']);
> $last = trim ($row['last_name']);
>
> if (!empty ($first) && !empty ($last))
> echo "$first $last<br/>\n";
> ...
> ?>
>
> HTH
> ~Philip
>