Hi,
I am trying to display data to the screen using the following code:
PHP Code:
<?php
$db_host = "localhost";
$db_name = "students";
$db_user = "root";
$db_pass = "";
$table = "students";
mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db($db_name) or die("Unable to select database.");
$data = mysql_query("SELECT * FROM $table");
$info = mysql_fetch_array($data);
while($info = mysql_fetch_array( $data )){
$comma_separated = implode(",", $info);
print $comma_separated;
}
?>
It works! However, I get a double up of the values like so:
2 2 Mike Mike 17 17 Male Male 05/06/1990 05/06/19903 3 Joann Joann 17 17 Female Female 26/06/1982 26/06/19824 4 Rachel Rachel 14 14 Female Female 23/07/1980 23/07/19805 5 Robert Robert 13 13 Male Male 23/06/1990 23/06/19906 6 Sarah Sarah 14 14 Female Female 21/4/1990 21/4/19907 7 evan evan e e e e e e8 8 fiona fiona f f f f f f
I checked over my code to see what might be causing the problem but I can't find it.
Thanks,
Nightwalker