Weird MySQL error

From: Date: Wed, 01 Nov 2000 13:17:20 +0000
Subject: Weird MySQL error
Groups: php.windows 
Request: Send a blank email to php-windows+get-3618@lists.php.net to get a copy of this message
I get an odd MySQL error, "No Database Selected", whenever I run a certain file containing the following code: $db = mysql_connect ("localhost", $user, $pw); mysql_select_db("klokke", $db); $sql = "UPDATE users SET password='" . $password . "' WHERE userrid=" . $id; $result = mysql_query($sql); if ($result == False) { echo "Error!<br>"; echo mysql_error(); die; } mysql_close($db); The odd part is, that the error is only experienced: - whenever the file is run on my webhost's server, not locally on my computer - with the same version of PHP and MySQL - when the code is contained in a certain file. If I execute the code via phpMyAdmin or copy/paste it into another file, no errors occur... - Using UPDATE on the same database and the same table but in other situations works just fine Why is this??!

« previous php.windows (#3618) next »