database_connect_traditional.php

<?php

/*
    FUNCTION: database_connect();

    Opens and returns a database connection on call

    PARAMETERS: $mysql_host    - (call optional as default is set) Defines the server host
                $database_user - (call optional as default is set) Defines the database username
                $user_password - (call optional as default is set) Defines the users password
                $database_name - (call optional as default is set) Defines the database to connect to

*/

function database_connect($mysql_host    'localhost',
                          
$database_user 'pm5494',
                          
$user_password 'password',
                          
$database_name 'pm5494')
{
  
$connection = @mysql_connect ($mysql_host,$database_user$user_password) or die ("Cannot make the connection");
  
//connect to  the database

  //Select relevant database
  
@mysql_select_db ($database_name,$connection) or die ("Cannot connect to the database");

return 
$connection;

}

?>

Paul's Code Library

Categories

Home

AJAX

classes

database_functions

date_functions

file_functions

googlevideo_and_youtube_api

htaccess

image_functions

string_functions