Repeats of values
| From: | Anthony Ritter | Date: | Tue, 31 Dec 2002 16:47:57 +0000 |
| Subject: | Repeats of values | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-129778@lists.php.net to get a copy of this message | ||
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