-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathdbtest.php
More file actions
33 lines (31 loc) · 822 Bytes
/
dbtest.php
File metadata and controls
33 lines (31 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/*
* alle Fehler auf Display anzeigen
*/
error_reporting ( E_ALL );
ini_set ( "display_errors", 1 );
define ( 'DB_SERVER', "localhost" );
define ( 'DB_USER', "root" );
define ( 'DB_PASSWD', "root" );
define ( 'DB_NAME', "klabu" );
// Attempt connection
try {
// Create connection to MYSQL database
// Fourth true parameter will allow for multiple connections to be made
$db_connection = mysql_connect ( '127.0.0.1:4850', 'root', 'root' );
mysql_select_db ( DB_NAME );
if (! $db_connection) {
throw new Exception ( 'MySQL Connection Database Error: ' . mysql_error () );
} else {
$CONNECTED = true;
}
} catch ( Exception $e ) {
echo $e->getMessage ();
}
$success_select = mysql_select_db ( 'test' );
echo $db_connection;
echo '<br>';
echo '=>'.$success_select.'<=';
echo '<br>';
echo '<br>fertig';
?>