Re: Sorry forgot to include the code for my last message - Mike Francis

From: Date: Sun, 12 Dec 2004 05:25:22 +0000
Subject: Re: Sorry forgot to include the code for my last message - Mike Francis
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-204089@lists.php.net to get a copy of this message
On Sun, 12 Dec 2004 07:03, Mike Francis wrote: > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <title>Our List of Jokes</title> > <meta http-equiv="content-type" > content="text/html; charset=iso-8859-1" /> > </head> > <body> > <?php > // Connect to the database server > $dbcnx = @mysql_connect('localhost', 'root', 'MyPassword'); > if (!$dbcnx) { > echo '<p>Unable to connect to the ' . > 'database server at this time.</p>' ); Note that using the @ in front of the connect suppresses any error messsages that may be returned from the connect; I would get rid of that. Then add here: echo mysql_error(); > exit(); > } > // Select the jokes database > if (!@mysql_select_db('ijdb')) { And use mysql_error() here too. > exit('<p>Unable to locate the joke ' . > 'database at this time.</p>'); > } > ?> mysql_error() will return a useful error message. -- David Robley Backups? We doan *NEED* no steenking baX%^~,VbKx NO CARRIER

« previous php.general (#204089) next »