Re: [PHP] Foreach question (solved)

This is a discussion on Re: [PHP] Foreach question (solved) within the PHP General forums, part of the PHP Programming Forums category; Thanks. I solved it using this : $x = 0; foreach ($equipos as $key => $val){ $x = $x + 1; echo "<...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-15-2007
Juan Marcelo Rodríguez
 
Posts: n/a
Default Re: [PHP] Foreach question (solved)

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@swplumb.com>:
>
> $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
>
>


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:06 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0