diff options
author | patdenice <patdenice@piwigo.org> | 2010-03-21 21:15:54 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2010-03-21 21:15:54 +0000 |
commit | 54c9ceb0f4890c7f183842f9c3adefaad64c471b (patch) | |
tree | 95cbae46dfba49cdc9c7599e8c2fcaf35b8f6ed3 /include/dblayer/functions_mysql.inc.php | |
parent | 62ce6a7f152439d33b18363daf400818002b9234 (diff) |
feature 1255: add pwg_select_db function.
git-svn-id: http://piwigo.org/svn/trunk@5230 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/dblayer/functions_mysql.inc.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/include/dblayer/functions_mysql.inc.php b/include/dblayer/functions_mysql.inc.php index 6c8248f92..6ada73a59 100644 --- a/include/dblayer/functions_mysql.inc.php +++ b/include/dblayer/functions_mysql.inc.php @@ -32,14 +32,18 @@ define('DB_RANDOM_FUNCTION', 'RAND'); * */ -function pwg_db_connect($host, $user, $password, $database) +function pwg_db_connect($host, $user, $password, $database=null, $die=true) { - $link = mysql_connect($host, $user, $password) or my_error('mysql_connect', false); - mysql_select_db($database, $link) or my_error('mysql_select_db', false); + $link = @mysql_connect($host, $user, $password) or my_error('mysql_connect', $die); return $link; } +function pwg_select_db($database, $link, $die=true) +{ + return @mysql_select_db($database, $link) or my_error('mysql_select_db', $die); +} + function pwg_db_check_charset() { defined('PWG_CHARSET') and defined('DB_CHARSET') |