iarp Posted May 6, 2008 Share Posted May 6, 2008 On one of my pages i have <?php site_name(); ?> I get the error: Notice: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /homepages/31/d204952132/htdocs/iarp/includes/session.php on line 65 the function site_name() is: function site_name() { include_once('../includes/mysql_connect.php'); $query = "SELECT site_name FROM " . TBL_CONFIG; $result = mysql_query($query) or trigger_error (mysql_error()); if ($result) { echo $page_title; } mysql_close(); } Can you not call a mysql database in a function? Quote Link to comment https://forums.phpfreaks.com/topic/104367-function-cant-connect-to-mysql-but-eveyrthing-else-can/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.