Re: connecting to db

From: Date: Thu, 22 Aug 2002 04:12:38 +0000
Subject: Re: connecting to db
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-113587@lists.php.net to get a copy of this message
$dbhost = ''; // MySQL server hostname $dbuser = ''; // MySQL username $dbpass = ''; // MySQL password $dbname = ''; // MySQL database name mysql_connect("$dbhost", "$dbuser") && mysql_select_db("$dbname") or $failed = "Could not connect to database."; "Jim Long" <jim@jimlong.net> wrote in message news:3D646230.C2E17CE1@jimlong.net... > Hi, > > Just setting up a new db at a new domain and the connection script does > not work. > I've always been able to connect to a db using the following: > > <?php > > // Connect to the database server > $dbcnx = @mysql_connect("localhost", > "username", "password"); > if (!$dbcnx) { > echo( "<P>Unable to connect to the " . > "database server at this time.</P>" ); > exit(); > } > > > > The host support suggests the following: > > > Root as the mysql user and localhost as the server, unless you selected remote mysql > > connections from the web control panel. > > BTW: I DID select remote mysql. Should I unselect it? > > FMI (forgive my ignorance): > > What connection script should I use? > > Thanks So Much in Advance, > Jim Long

« previous php.general (#113587) next »