MySQL Query Weirdness

From: Date: Thu, 20 Sep 2001 22:02:37 +0000
Subject: MySQL Query Weirdness
Groups: php.db 
Request: Send a blank email to php-db+get-12624@lists.php.net to get a copy of this message
Hello, I'm new at this php/mysql stuff, so go easy on my guys. I've got my query script up and working, but the problem is I'm getting the same column printed twice on the html output. Here is the output: Connected successfully Chris Chris Mark Mark Mike Mike Dee Dee etc... Here is my .php script: <?php $link = mysql_connect("localhost", "dbuser","dbpassword") or die ("Could not connect"); print ("Connected successfully"); mysql_select_db ("dapscores") or die ("Could not select database"); $query = "SELECT first_name FROM overall_results"; $result = mysql_query ($query) or die ("Query failed"); // printing HTML result print "<table>\n"; while ($line = mysql_fetch_array($result)) { print "\t<tr>\n"; while(list($col_name, $col_value) = each($line)) { print "\t\t<td>$col_value</td>\n"; } print "\t</tr>\n"; } print "</table>\n"; mysql_close($link); ?> Here is my database layout: mysql> describe overall_results; +---------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+-------------+------+-----+---------+-------+ | Match_Date | date | YES | | NULL | | | Place | varchar(10) | YES | | NULL | | | Last_Name | varchar(20) | YES | | NULL | | | First_Name | varchar(20) | YES | | NULL | | | USPSA | varchar(10) | YES | | NULL | | | Class | char(3) | YES | | NULL | | | Division | varchar(20) | YES | | NULL | | | PF | varchar(7) | YES | | NULL | | | Lady | char(3) | YES | | NULL | | | Mil | varchar(4) | YES | | NULL | | | Law | varchar(4) | YES | | NULL | | | F0r | char(3) | YES | | NULL | | | Age | varchar(20) | YES | | NULL | | | Match_Pts | float | YES | | NULL | | | Match_percent | float | YES | | NULL | | +---------------+-------------+------+-----+---------+-------+ If I run the query from mysql>, it works fine, just the HTML output shows the double column thing. Is this a database problem? I've tried different variations of my script and I get the same output each time. Thanks -- Chris S. chris@c62023-a.wntck1.sfba.home.com PGP 0xDA39672B

« previous php.db (#12624) next »