Hi,

Wednesday, January 1, 2003, 2:47:57 AM, you wrote:
AR> I'm running the following sql query which outputs a repeat value for each
AR> field in the html cell box.

AR> Like this:
AR> ......................
AR> 3.3 3.3 78 78 2002-06-11 2002-06-11
AR> ...................

AR> which is not what I would like.

AR> I was trying to get:
AR> .............................
AR> 3.3 78 2002-06-11
AR> ........................

AR> I thought that by dropping off the $key in the $key - $value pair
AR> to:

AR> while(list (,$value) = each ($line))

AR> would accomplish that.

AR> The SQL query is:

AR> SELECT level, pm, date FROM daytime WHERE pm >=75
AR> ............................

AR> The php script is:

AR> <?php
AR>     $link = mysql_connect("", "", "")
AR>         or die ("Could not connect");
AR>     mysql_select_db ("water")
AR>         or die ("Could not select database");


AR>     $query = "SELECT level, pm, date FROM daytime WHERE pm >= 75";
AR>     $result = mysql_query ($query)
AR>         or die ("Query failed");

AR>  // printing HTML result


AR>         print ("<Font Face=\"arial\" size=3>Dates where water exceeded 75
AR> degrees<BR> at Callicoon, New York - 2002</FONT>");
AR>  print("<P>");
AR>         print "<table border=1>\n";

AR>  while($line = mysql_fetch_array($result)){
AR>   print "\t<tr><td bgcolor=\"#CCCCFF\"><Font Face=\"arial\" size =2>\n";
AR>   while(list (,$value) = each ($line)) {
AR>    print "<td bgcolor=\"CCCCFF\"><Font Face =\"arial\"
size=2>>$value</td>\n";
AR>   }
AR>   print "\t</tr>\n";
AR>  }
AR>  print "</table>\n";

AR>     mysql_close($link);
?>>
AR> ..........................................

AR> Any help would be greatly appreciated.
AR> Happy New Year!

AR> Tony Ritter

change this line

while($line = mysql_fetch_array($result)){

to

while($line = mysql_fetch_assoc($result)){

mysql_fetch_array() builds a numerical and a associative array for each row.

-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to