Re: Looping output to table header

From: Date: Thu, 08 May 2003 10:52:22 +0000
Subject: Re: Looping output to table header
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-146819@lists.php.net to get a copy of this message
Howdy, I have resolved this one..... Thanks Chris On Thu, 2003-05-08 at 10:27, Chris Blake wrote: > Greetings learned PHP(eople), > > I have a text file, the content of which is made into an array. > I want to strip out the first line of the text file which contains the > column headers, and output them to a table row as headers for the table. > > Instead of referencing each element of the first line by using its array > element number, I want to put the number of elements into a loop and > generate the table header using $i, but its not working. > > Here`s the snippet code for making the <th> > I tried using while() nested below the for() loop, but my browser hangs > and CPU usage maxes out..... > ------------------------------------------------------------ > echo "<table border='0'>\n"; > echo "<tr>\n"; > //Get column headers (first line) from text file > for ($i = 0; $i < 1; $i++) > { > $headers = explode( "\t", $products[$i]); > } > //THIS WORKS BY USING THE ARRAY ELEMENT NUMBER< BUT I WANT $i > echo "<th bgcolor='#ccccff'>" . $headers[0] . > "</th>\n"; > > echo "</tr>\n\n"; > ----------------------------------------------------------- > > Ideas ? > > -- > Chris Blake > Office : (011) 782-0840 > Cell : 083 985 0379 > The right half of the brain controls the left half of the body. This > means that only left handed people are in their right mind. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Chris Blake Office : (011) 782-0840 Cell : 083 985 0379 The right half of the brain controls the left half of the body. This means that only left handed people are in their right mind.

« previous php.general (#146819) next »