php can not access to the database password

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yk
Forum Newbie
Posts: 2
Joined: Thu Apr 08, 2004 3:42 am

php can not access to the database password

Post by yk »

please... can some one tell me what the problem with the following command.


@ $db = mysql_pconnect('localhost', 'root', 'somepassword');

if (!$db)
{
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

why are you doing that?

use

Code: Select all

$server = "localhost";
$user = "username";
$pass = "password";
$database = "database";

mysql_pconnect('$server', '$user', '$pass') or die(mysql_error());
mysql_select_db('$database') or die(mysql_error());
Post Reply