Hi,
I have been driven to use a databse with my php apps, so i downloaded, installed mysql and all works.
But on my first php app to test mysql it is repeating values.
The php code:
<?php
$link = mysql_connect("localhost", "mysql", "mysql") or die("Could not connect to MySQL Server at localhost");
print("Connected Successfully to MySQL Server at localhost");
mysql_select_db("articles") or die("Could not select database articles");
$query = "SELECT * FROM article";
$result = mysql_query($query) or die("Query failed");
// Print out table in HTML
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);
?>
and the output:
Connected Successfully to MySQL Server at localhost1 1 2 2 Elfyn Elfyn 9 9 1 1 1 1 0000-00-00 0000-00-00
2 2 3 3 Elfyn Elfyn 9 9 2 2 2 2 2001-09-11 2001-09-11
Im guessing it shouldnt do this, does anyone know how i can stop it doing this?
Cheers,
Elfyn