I've used this code before and it's currently working for one website. Now testing on another it returns No database selected.
I can't seem to find any reason why. I've seen some stuff about saying I should be using mysqli. I tried but got:
"Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in /home/mediqw5/public_html/bvcenter/test.php on line 31"
and 2 similar errors for the $result line.
Thanks.
Code:
<?php
$username="user";
$host="localhost";
$password="*****";
$database="mydatabase";
$con = mysql_connect($host,$username,$password);
if(!$con)
{
die("Unable to select database");
}
mysql_select_db($database,$con);
$sql = "SELECT * FROM donors ORDER BY lastname, firstname";
$result = mysql_query($sql) or die(mysql_error());
?>
"Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in /home/mediqw5/public_html/bvcenter/test.php on line 31"
and 2 similar errors for the $result line.
Thanks.