Hi, I see two things that strike me right of the bat as being incorrect in reference to your first line of code:
i) You cannot use "global" when supplying a default argument value like that
ii) You cannot use a "variable" when supplying a default argument value either.
So, if I am thinking clearly here, you may have to rewrite your first line to something like this:
<?php
function db_connect($dbname, $dbhost, $dbuser, $dbpass) {
global $sql;
if (!$sql) {
$sql = mysql_connect($dbhost, $dbuser, $dbpass)
or die('Cause of death: Could not connect to ' . $dbhost);
}
$db = mysql_select_db($dbname, $link1)
or die('Cause of death: Could not select ' . $dbhost);
}
?>
EDIT: If this is wrong, I apologize! LOL!!! ME NEED COFFEE!!!