// Here is the function. This function must be placed before any HTML code or
// else the redirect will not work. You could place it in a separate file and
// use include.
function dbconnect($hostname, $username, $password, $database) {
$conn = @mysql_pconnect($hostname, $username, $password); // "@" is
necessary.
if(!$conn) header("Location: error.html");
if(!mysql_select_db($database, $conn)) header("Location: error.html");
}
// This is how to call the function. This must also be placed before any HTML
// code or else the redirect will not work.
dbconnect($host, $user, $pwd, $db);
Newbie Notes #4 - Trapping dumb MySQL query errors Categories : PHP , Databases , MySQL , Debugging , Beginner Guides bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager Categories : MySQL , PHP , MySQL , Complete Programs , Databases This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server. Categories : Databases , MySQL , Complete Programs , PHP , Databases MyOrgBook - Online Organizer written in PHP & MySql. Includes online contacts, todo, calendar, update, delete, insert, multi-user interface. Categories : PHP , MySQL , Calendar , PDAs and Organizers , Databases Simple usersOnline class - keep track of how many users are online on your site Categories : PHP , PHP Classes , Databases , MySQL A simple script to count and report hits and the last
modification time of an HTML page. Requires MySQL support
(other DBs should work too, except possibly mSQL). Categories : HTTP , MySQL , PHP , Databases MySQL Web Interface Categories : MySQL , Databases , PHP A PHP useradmin for MySQL. Uploading is easy. The only thing you need is
PHP and MySQL installed! Categories : MySQL , Databases , PHP , HTML and PHP PostGreSQL and MySQL 2 in 1 db Manager Categories : PHP , PHP Classes , Databases , PostgreSQL , MySQL AJAX Data Grid System using php and mysql. A complete login system with the ability to display data in a grid using ajax. Add , update and delete the records without reloading the page. Categories : PHP , AJAX , Databases , MySQL , Java Script Loading Images to/from MySQL Categories : Databases , MySQL , PHP , Graphics Solution to those 'tell-a-friend' type email issues Categories : PHP , Email , Databases , MySQL PHP Object Example of the Perl DBI with MySQL Categories : PHP , PHP Classes , MySQL , Databases , Perl [PHP5] aDB PDO LIKE Database Abstraction. Switch easily from one db server to another, strong errors management, manage transactions, queries preparation and more. Categories : PHP , PHP Classes , Databases , MS SQL Server , MySQL Simple function to return the number of days in a time span between 2 given dates. Categories : PHP , Date Time , MySQL , Databases