这似乎应该很容易,但我没有收到错误或任何结果:
$connection = mysql_connect("phpexamplesite.db.4211592.hostedresource.com", "username", "password");
if(!$connection) {
die("Database connection failed: " . mysql_error());
}
//2. Select a database to use
$db_select = mysql_select_db("username", $connection);
if(!$db_select){
die("Database selection failed: " . mysql_error());
有任何想法吗?
谢谢:)
对此感到抱歉...我确实将查询放入:
// 3. Perform database query
$result = mysql_query("SELECT * FROM subjects", $connection);
if(!$result){
die("Database query failed: " . mysql_error());
}
//4. Use returned data
while($row = mysql_fetch_array($result)) {
echo $row["menu_name"]. " ".$row["position"]. "<br />";
}
?>
<?php
//5. Close connection
mysql_close($connection);
?>
我在页面上没有收到任何错误或结果...