|
how to display the data base in a dyanmic way
|
|
|
<?php
|
|
|
$host = 'localhost';
|
servername
|
|
$user = 'root';
|
|
|
$pass = '';
|
|
|
$dbname = 'lesson44';
|
create a database name using procedure and before that select
server
|
|
|
|
|
if($mycon = @mysqli_connect($host, $user, $pass)){
|
connect to this server
|
|
|
|
|
if(@mysqli_select_db($mycon, $dbname)){
|
connect to database
|
|
//echo 'connected to the DB';
|
if it is not connected, it will display some message about why
it is not connected
|
|
} else {
|
|
|
//echo 'DB connection failed';
|
|
|
} }
|
|
|
|
|
|
else {
|
|
|
//echo 'server connection failed';
|
|
|
}
|
|
|
|
|
|
|
|
|
?>
|
| how to connect to server and database , if and else also display | variables |
| $ | |
| @mysqli_connect | |
| @mysqli_select_db |
No comments:
Post a Comment