Saturday, January 31, 2009

Re: if then isn't working

On Jan 31, 4:56 pm, thankyou <gregbo...@gmail.com> wrote:
> ** im a beginner :)
>
> I'm trying to get this to make 20 rows of 5 colums each and I'm
> continuing to get errors. Any idea what's wrong?  Here's the code:
>
> <table width='100%' border='0'>
> <tr>
> <td width='100%' align='center'>
>         <table>
> <?php
>               $text = ' area code';
for ( $i = 0; $i < 20; $i++ ) // Number of rows!
>                 {
>                         for($j = 0; $j < 10; $j++)
>                         {
>
>                             if($j == 4)
>                            {
>                                 echo("<tr><td width='225px'>");
>                                }
>                                 echo($html->link($firstNumber . $i. $j . $text , "/AreaCodes/
> detail/". $firstNumber . $i. $j, array('class'=>'area_code_link')));
>                                 echo("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
>                         }
>                         echo("</td></tr>");
>                 }
>
> ?>
> </table>
> </td>
> </tr>
> </table>
>
> <?
>         }
> ?>

Correct your code! Use comments more, so you understand it yourself!

for ( $i = 0; $i < 20; $i++ ) // Number of rows! 0 to 19 = 20
{
echo "<tr>";
for ( $j = 0; $j < 5; $j++ ) // Number of columns in a row! 0 to 4
= 5
{
echo "<td>"; // Start of column
echo $html->link($firstNumber . $i. $j . $text , "/AreaCodes/
detail/". $firstNumber . $i. $j, array('class'=>'area_code_link'));
echo "</td>"; // End of column
}
echo "</tr>\n"; // End of row
}

Next time, do write what errors you are getting! That will help a lot!
Enjoy
John

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: