Re: Foreach question (solved)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks.

I solved it using this :

$x = 0;

foreach ($equipos as $key => $val){

$x = $x + 1;
echo "<tr><td>";
echo $x . "</td><td>";

2007/11/15, Michael McGlothlin <michaelm@xxxxxxxxxxx>:
>
> $x = 0;
> foreach ( $blah as $bleh ) {
> $x = $x + 1;
> print "$x: $bleh";
> }
>
> > HI,
> > I'm working with an associative array, and generating its data a form. I
> use
> > foreach to loops the contents of the array and echo to print the table
> and
> > the data. Everything goes well, however I would like to add a counter to
> > print the row's number.
> >
> > The question : Am I able to add a counter within foreach to print the
> row
> > number in each row using echo ?. I tried a few things but I couldn't.
> >
> > Thanks!
> >
> > Juan
> >
> >
>
>
> --
> Michael McGlothlin
> Southwest Plumbing Supply
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux