[snip] function connect_db() { if (!defined('_CONNECT_DB')) {
$result = @mysql_pconnect("localhost", "Username", "Password"); @mysql_select_db("database_name"); define('_CONNECT_DB', $result); } return _CONNECT_DB; I call this function this way... $query = "SELECT * FROM table"; $connid = connect_db(); $result = mysql_query($query, $connid); [/snip] I think you want to look into pass by reference. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php