Tuesday, 9 June 2020

how to say or design a template, about m if connected do this if not do this

dbconnect.php
<?php
$host = 'localhost';
$user = 'root';
$pass = '';
$dbname = 'mydatabase';

if($mycon = @mysqli_connect($host, $user, $pass)){
page will coonect to the server
//echo 'connected to the server';
priunts perfectly connected to server
if(@mysqli_select_db($mycon, $dbname)){
connects to data base
//echo 'connected to the DB';
if perfectly connected, it prints, perfectely connected to database
} else {
//echo 'DB connection failed';
} }

else {
//echo 'server connection failed';
}


?>
With require and include, we can get the variables used in that template and results also



@mysqli_connect
@mysqli_select_db
if if else else


how to connect to  server
how to connect to data base

No comments:

Post a Comment