RE: [PHP] IF inside LOOP?
| From: | Ford, Mike [LSS] | Date: | Wed, 17 Jul 2002 09:45:19 +0000 |
| Subject: | RE: [PHP] IF inside LOOP? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108045@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: César Aracena [mailto:icaam@icaam.com.ar]
> Sent: 15 July 2002 03:04
> This is what I have so far:
>
> for ($m=0; $m<$num_rows2; $m++)
> {
> $row2 = mysql_fetch_array($result2);
>
> echo $row2[devlanguage];
>
> if ($m < $num_rows2)
> {
> echo ", ";
> }
> else
> {
> echo ".";
> }
> }
My approach to this is like this:
for ($m=0; $m<$num_rows2; $m++)
{
$row2 = mysql_fetch_array($result2);
if ($m>0) echo ', ';
echo $row2[devlanguage];
}
echo '.';
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211