Revision: 1215
Updated Code
at September 26, 2006 06:21 by gdonald
Updated Code
if( in_array( 'mysql', $GLOBALS[ 'loaded_extensions' ] ) )
{
if( $GLOBALS[ 'dbHandle' ] = mysql_connect( $GLOBALS[ 'DB_HOST' ],
$GLOBALS[ 'DB_USER' ],
$GLOBALS[ 'DB_PASS' ] ) )
{
mysql_select_db( $GLOBALS[ 'DB_DB' ], $GLOBALS[ 'dbHandle' ] );
}
else
{
die( 'Cannot select database ' . $GLOBALS[ 'DB_DB' ] . ': ' . mysql_error() );
}
}
elseif( in_array( 'mysqli', $GLOBALS[ 'loaded_extensions' ] ) )
{
$GLOBALS[ 'dbHandle' ] = mysqli_connect( $GLOBALS[ 'DB_HOST' ],
$GLOBALS[ 'DB_USER' ],
$GLOBALS[ 'DB_PASS' ],
$GLOBALS[ 'DB_DB' ] );
if( mysqli_connect_errno() )
{
die( 'Cannot connect to database ' . mysqli_connect_error() );
}
}
else
{
die( 'MySQL extension is not loaded' );
}
Revision: 1214
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 26, 2006 06:19 by gdonald
Initial Code
if( in_array( 'mysql', $GLOBALS[ 'loaded_extensions' ] ) )
{
if( $GLOBALS[ 'dbHandle' ] = mysql_connect( $GLOBALS[ 'DB_HOST' ],
$GLOBALS[ 'DB_USER' ],
$GLOBALS[ 'DB_PASS' ] ) )
{
mysql_select_db( $GLOBALS[ 'DB_DB' ], $GLOBALS[ 'dbHandle' ] );
}
else
{
die( 'Cannot select database ' . $GLOBALS[ 'DB_DB' ] . ': ' . mysql_error() );
}
}
elseif( in_array( 'mysqli', $GLOBALS[ 'loaded_extensions' ] ) )
{
$GLOBALS[ 'dbHandle' ] = mysqli_connect( $GLOBALS[ 'DB_HOST' ],
$GLOBALS[ 'DB_USER' ],
$GLOBALS[ 'DB_PASS' ],
$GLOBALS[ 'DB_DB' ] );
if( mysqli_connect_errno() )
{
die( 'Cannot connect to database ' . mysqli_connect_error() );
}
}
else
{
die( 'MySQL extension is not loaded' );
}
Initial URL
Initial Description
Initial Title
php mysql/mysqli connect
Initial Tags
mysql
Initial Language
PHP