Tuesday, 9 June 2020

DBCONECT

lesson44.php
connect to database
<?php
$host = 'localhost';
$user = 'root';
$pass = '';
$dbname = 'lesson44';
 
if($mycon = @mysqli_connect($host, $user, $pass)){
 
if(@mysqli_select_db($mycon, $dbname)){
//echo 'connected to the DB';
} else {
//echo 'DB connection failed';
} }
 
else {
//echo 'server connection failed';
}
 
 
?>

No comments:

Post a Comment