I am having an interesting problem with php and mysql.
I am trying to write a simple connect and query script to mysql on my localhost(same host as webserver) and am having some problems retrieving data, also anything that is below the php code disappears when you do a view source on the web site.
I am running apache2, I have installed php5 and other php commands work like echo.
Here is the php code:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php
$con = mysql_connect("localhost", "user", "pass"); // corrected mysql spellings
if(!$con)
{
die('could not connect to server: ' . mysql_error());
}
mysql_select_db("db", $con);
$result = mysql_query("SELECT * FROM user_list");
while($row = mysql_fetch_array($result))
{
echo $row['name'] . "<br />";
}
mysql_close($con);
echo "hello";
?>
trying testing
</body>
</html>
Please let me know if there is anything I should check to see if my server setup is correct.
Thanks,
Andy