note 84675 deleted from function.mysql-connect by sobak

From: Date: Sun, 04 Dec 2016 17:06:59 +0000
Subject: note 84675 deleted from function.mysql-connect by sobak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208217@lists.php.net to get a copy of this message
Note Submitter: Boris K ---- Coderlit and angelo, this may be the solution: <?php if (!isset($g_link)) { $g_link = false; } function GetMyConnection() { global $g_link; if( $g_link ) return $g_link; $g_link = mysql_connect( 'localhost', 'dbuser', 'dbpass') or die('Could not connect to mysql server.' ); mysql_select_db('wordpress', $g_link) or die('Could not select database.'); return $g_link; } function CleanUpDB() { global $g_link; if( $g_link != false ) mysql_close($g_link); $g_link = false; } ?>

« previous php.notes (#208217) next »