Hi, I think changing while(list (,$value) = each ($line)) { to foreach ($line as $value) {
might help but I'm unsure, either way foreach is easier to read :) Andrew ----- Original Message ----- From: "Anthony Ritter" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 31, 2002 4:47 PM Subject: [PHP] Repeats of values > I'm running the following sql query which outputs a repeat value for each > field in the html cell box. > > Like this: > ...................... > 3.3 3.3 78 78 2002-06-11 2002-06-11 > ................... > > which is not what I would like. > > I was trying to get: > ............................. > 3.3 78 2002-06-11 > ........................ > > I thought that by dropping off the $key in the $key - $value pair > to: > > while(list (,$value) = each ($line)) > > would accomplish that. > > The SQL query is: > > SELECT level, pm, date FROM daytime WHERE pm >=75 > ............................ > > The php script is: > > <?php > $link = mysql_connect("", "", "") > or die ("Could not connect"); > mysql_select_db ("water") > or die ("Could not select database"); > > > $query = "SELECT level, pm, date FROM daytime WHERE pm >= 75"; > $result = mysql_query ($query) > or die ("Query failed"); > > // printing HTML result > > > print ("<Font Face=\"arial\" size=3>Dates where water exceeded 75 > degrees<BR> at Callicoon, New York - 2002</FONT>"); > print("<P>"); > print "<table border=1>\n"; > > while($line = mysql_fetch_array($result)){ > print "\t<tr><td bgcolor=\"#CCCCFF\"><Font Face=\"arial\" size =2>\n"; > while(list (,$value) = each ($line)) { > print "<td bgcolor=\"CCCCFF\"><Font Face =\"arial\" > size=2>$value</td>\n"; > } > print "\t</tr>\n"; > } > print "</table>\n"; > > mysql_close($link); > ?> > .......................................... > > Any help would be greatly appreciated. > Happy New Year! > > Tony Ritter > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php