CODE
<?php
function database($call) {
global $database;
switch($call) {
case 'connect':
$connection = mysql_connect($database['server'], $database['username'], $database['password']);
mysql_select_db($database['name'], $connection);
break;
case 'close':
mysql_close($connection);
break;
}
}
?>
function database($call) {
global $database;
switch($call) {
case 'connect':
$connection = mysql_connect($database['server'], $database['username'], $database['password']);
mysql_select_db($database['name'], $connection);
break;
case 'close':
mysql_close($connection);
break;
}
}
?>
$database is an array in a configuration file where I have the necessary values set to connect to the MySQL database (which, by the way, are correct). And before someone goes ape-shit on me for extending this out to such a time-wasting function, I'm using it for cleaner syntax on most of all my other pages (instead of having to type out the $connection variable, selecting the database, and [at times] closing it for each page). This actually worked just fine before, but now it's generating this error:
CODE
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in _________________/includes/functions.php on line 144
Hilfe?