View Single Post
  #20 (permalink)  
Old 12-03-2008, 06:30 PM
jontywagener's Avatar
jontywagener jontywagener is offline
Experienced Member
 
Join Date: Oct 2007
Location: South Africa
Posts: 126
Default

heres my two cents:
i quite like this kind of mysql connection script, i spose u could use it for postgresql without too much difficulty.


// add your information here.
define(HOST, 'localhost');
define(USER, 'yourusername');
define(PASS, 'yourpassword');
define(BASE, 'yourdatabase');

/// --- you would not really need to edit below here --- ///
// add some connection error handling so that we get a nice error.

// check the connection string.
if(!@mysql_connect(HOST, USER, PASS)) {
echo "Database could not be connected to. Please check your settings";
}

// then we check the selection string.
if(!@mysql_select_db(BASE)) {
echo "The database selection could not be completed. Please check your settings.";
}

?>

im probably a little late but anyway :)
__________________
its just me :)
Reply With Quote