While it's apparently not always required, I always reccommend (and always
do it personally) that you use a bracket around every function.
So it should lool like this:
<?
error_reporting(E_ALL);
for( $i=0; $i<10; $i++ )
{
for( $j=0; $j<10; $j++ )
{
$res = $i * $j;
print(" result = $res <br>");
}
}
?>
It makes it easier to see where the loops begin and where they end, and it
stops most types of errors from appearing.
--
Plutarck
Should be working on something...
...but forgot what it was.
<[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Howdy Y'all!
>
> I'm trying to figure out why I'm having so much difficulty with
> nested for loops.
>
> As a test, I did this and it doesn't work. The script simply doesn't
> give any output.
>
> <?
> error_reporting(E_ALL);
>
> for( $i=0; $i<10; $i++ )
> for( $j=0; $j<10; $j++ )
> {
> $res = $i * $j;
> print(" result = $res <br>");
> }
> ?>
>
> If I remove the inner loop then it works fine but that's useless.
>
> I am hoping to figure out how to make this work since I need to
> populate a 2 dimensional array with results from multiple database
> queries.
>
> Any ideas? Anything obviously wrong?
>
> Thanks in advance!
> John
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]