[PHP] No Database Connection possible (mySQL)
Hi all, I am having problems with a connection to a mysql database. I am using function con() { mysql_connect(localhost,user,pass) or die(mysql_error()); mysql_select_db(tava) or die(mysql_error()); } Now, when I call the _function_ (!) con() or die(no con); I get the no con output. When I call the mysql_connect and mysql_select directly before executing a query, I get some DB output. But that won't work when I am using the function... Any ideas would be greatly appreciated. Cheers! Chris
[PHP] FW: [SPAM] [PHP] No Database Connection possible (mySQL)
-Original Message- From: Aviation Coding [mailto:[EMAIL PROTECTED] Sent: Friday, July 04, 2008 10:15 AM To: php-general@lists.php.net Subject: [SPAM] [PHP] No Database Connection possible (mySQL) Importance: Low Hi all, I am having problems with a connection to a mysql database. I am using function con() { mysql_connect(localhost,user,pass) or die(mysql_error()); mysql_select_db(tava) or die(mysql_error()); } Now, when I call the _function_ (!) con() or die(no con); I get the no con output. When I call the mysql_connect and mysql_select directly before executing a query, I get some DB output. But that won't work when I am using the function... Any ideas would be greatly appreciated. Cheers! Chris It's a bit of a long shot but are you using variables in the function which might be out of scope? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FW: [SPAM] [PHP] No Database Connection possible (mySQL)
-Original Message- From: Chris Scott [mailto:[EMAIL PROTECTED] Sent: Friday, July 04, 2008 11:41 AM To: php-general@lists.php.net Subject: [PHP] FW: [SPAM] [PHP] No Database Connection possible (mySQL) Importance: Low -Original Message- From: Aviation Coding [mailto:[EMAIL PROTECTED] Sent: Friday, July 04, 2008 10:15 AM To: php-general@lists.php.net Subject: [SPAM] [PHP] No Database Connection possible (mySQL) Importance: Low Hi all, I am having problems with a connection to a mysql database. I am using function con() { mysql_connect(localhost,user,pass) or die(mysql_error()); mysql_select_db(tava) or die(mysql_error()); } Now, when I call the _function_ (!) con() or die(no con); I get the no con output. When I call the mysql_connect and mysql_select directly before executing a query, I get some DB output. But that won't work when I am using the function... Any ideas would be greatly appreciated. Cheers! Chris It's a bit of a long shot but are you using variables in the function which might be out of scope? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi mate, no, I am using no variables in the other function. The function goes like con() or die(no con); $query = SELECT ; and so on and I always get no con... Cheers! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php