I have installed PHP and MySQL on a linux box, and everything seems to work fine, except for the fact that i have some problems connection to mysql from PHP.
I try with the following code:
$conn = mysql_connect("localhost","root","");
mysql_select_db("mydatabase");
$sql = "SELECT * FROM Mytable";
$result = mysql_query($sql, $conn);
$rs = mysql_fetch_array($result);
echo $rs["Lastname"];
But i get this error:
Warning: Supplied argument is not a valid MySQL result resource in /home/mike/www/test.php on line 6
And i'm sure that i haven't made an error in the password or username. Becuase if i make an error in thoose intentionally i get an error saying permission denied etc on the connection. But i can't see anything wrong with the code i posted here.
Anybody who can help me?