i am trying to display a mysql table in my
html page have managed to round up the code to display the table data, i have saved that into a file called "mysq.
php"
i have then created a very simple page just to test whether/how i get this into
html....
here is what i have:
- Code: Select all
<html>
<body>
This is a test to show this can be done
<?php
include(mysql.php);
</body>
</html>
however my mysql data is not displayed........the text saying test is there but nothing else...
here is my data from the "mysql.
php" file
- Code: Select all
<html>
<head>
<title>PHP/MySQL example</title>
</head>
<body bgcolor="white">
<center>
<table border="1">
<tr><th>Reg_No</th><th>DOB</th></tr>
<?php
$host="hostname";
$user="username";
$password="password";
# Connect to MySQL server
$conn = mysql_connect($host,$user,$password)
or die(mysql_error());
# Select the database
mysql_select_db("uxellaleague", $conn)
or die(mysql_error());
# Send SQL query
$sql = "SELECT players_200506.reg_no, players_200506.dob
FROM players_200506
WHERE (((players_200506.reg_no)>0))
ORDER BY players_200506.reg_no;";
$result = mysql_query($sql)
or die(mysql_error());
# Fetch table rows, one by one, and display as HTML table rows
while ($row = mysql_fetch_assoc($result)) {
echo "<tr><td>", $row['reg_no'], "</td><td>", $row['dob'],
"</td></tr>\n";
}
?>
</table>
</center>
</body>
</html>
please advise
Andy