I have this little function do connect to a MySQL database:
function connectSugarCRM() { $connectorSugarCRM = mysql_connect ('localhost', '123', '123') or die ('Connection failed'); mysql_select_db('sugar5') or die ('Failed attempt to connect to database'); return $connectorSugarCRM; }
And then, to run a query, I’m doing something like this, but I allways get an ‘PHP Fatal error: Cannot redeclare connectSugarCRM() (previously declared in …’, which points to the definition of my function ‘connectSugarCRM’ (line 1).
$ExecuteSQL = mysql_query ($sqlSTR, connectSugarCRM()) or die ('Query Failed!');
What is wrong with my code? Thanks
Always use include_once or require_once when including other files.