Location: PHPKode > projects > top serious project > bco/functions/functions.db.php
<? 

/***************************************************************************
 *   Copyright 2003 Ian Meyer, Ian Pitcher
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

function bco_dbconnect() 
{
	if (!$db_resource = pg_connect("dbname=bco user=imeyer")) {
        bco_dberror($db_resource);
    } else {
	    return $db_resource;
    }
}

function bco_dberror($db_resource) 
{   
    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
    echo "\n<html>";
    echo "\n<head>";
    echo "\n<title>Database error!</title>";
    echo "\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />";
    echo "\n</head>";
    echo "\n<body>";
    echo "\n<table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\">";
    echo "\n    <tr>";
    echo "\n        <td colspan=\"5\"><div align=\"center\">";
    echo "\n            <h3>Connection to database failed. Please check your credentials.";
    echo "\n            </h3></div></td>";
    echo "\n    </tr>";
    echo "\n</table>";
    echo "\n</body>";
    echo "\n</html>";
    exit;
}

?>
Return current item: top serious project