Looping output to table header

From: Date: Thu, 08 May 2003 08:27:34 +0000
Subject: Looping output to table header
Groups: php.general 
Request: Send a blank email to php-general+get-146802@lists.php.net to get a copy of this message
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.

« previous php.general (#146802) next »