Jump to content

function cant connect to mysql but eveyrthing else can??


iarp

Recommended Posts

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.