I have the following script to access a mysql database, but it fails on line 7, couldn't connect. Any suggestions?
<?
$db_name = "php";
$db_user = "testphp";
$db_pass = "test";
$connection = mysql_connect("localhost","$db_user","db_pass") or die("Couldn't")
;
$db = mysql_select_db($db_name, $connection) or("Couldn't Select Database");
$sql = "SELECT * from table";
$result = mysql_query($sql, $connection)or die ("Couln't execute query.");
while ($row = mysql_fetch_array(result)) {
$id = $row['id'];
$name = $row['name'];
$text = "$id $name <br>";
}
echo $text;
?>