This seems like it should be so easy but I am not getting an error or any result:
$connection = mysql_connect("phpexamplesite.db.4211592.hostedres ource.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());
Any ideas?
THanks
---------- Post added at 10:50 AM ---------- Previous post was at 10:42 AM ----------
I think the error is in the connection but here is the rest of it:
// 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);
?>
I'm not getting any error or results on the page...