OK here is my problem. I was connecting to a db fine, everything worked. I decided to move the connection functions to a seperate header file. Then it stopped working all of a sudden. This exact code used to work perfect. Now it cannot select the database. BTW, $dbhost and the other vars are defined globaly.
function CheckPassword( $username ){
$link = mysql_connect($dbhost, $dbusername, $dbpassword)
or die("Could not connect");
mysql_select_db( $database )
or die("Could not select database:" . mysql_error());
$result = mysql_query("SELECT * FROM arc_users WHERE username='" . $_POST[username] ."'" );
if( $row[1] != $_POST[password] )
return 0;
mysql_close( $link );
return 1;
}
It always prints out "Could not select database:No Database Selected"
What is wrong?