Re: Connection to db
| From: | Chris Shiflett | Date: | Fri, 23 Aug 2002 23:09:04 +0000 |
| Subject: | Re: Connection to db | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113869@lists.php.net to get a copy of this message | ||
Jim,
What is this script supposed to output when you are successful? The only things I see output only occur for error conditions. So, maybe the problem is that it is working. :-)
Try putting an else statement in there and echo a success message of some sort. See if that helps.
Happy hacking.
Chris
Jim Long wrote:
I've use this script with many db connections at other domians I manage and it works fine:// Connect to the database server $dbcnx = @mysql_connect("localhost",For some reason, when I try it with a newer domain, I get "document contains no data" I've tryed this suggested by "Sami Mahamed" on this list.. THANKS!, The document works but when I try to *insert* into the db it returns error "no db selected""username", "pass");if (!$dbcnx) { echo( "<P>Unable to connect to the " ."database server at this time.</P>" );exit(); } // Select the newspost database if (! @mysql_select_db("name_of_db") ) { echo( "<P>Unable to locate the newspost " ."database at this time.</P>" );exit(); }$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.";I'm quite frustrated at this point. Thanks For Any Help, Jim Long