Simple MySQL connect wouln't work!!

wxdqz

New Member
I am kinda of a newbie, not to PHP but to MySQL.
I can't seem to find anything wrong with this.
When I execute the script I get the "DIE" message "Couldn't execute that query!"
Can anyone help me out, it's killing me!! =(


$host = "localhost";
$username = "my_name";
$password = "password";
$database = "database";
$table = "users";


$db = mysql_connect($host, $username, $password) or DIE ("Can't connect to the MySQL database...");

mysql_select_db($database, $db) or DIE ("Can't find the database: <b>$database</b>");

$name = mysql_query("SELECT count(*) FROM $table WHERE name=$name, $db") or DIE ("Couldn't execute that query!");
echo $name;
 
Back
Top