I develop this system using Object oriented PHP
and PDO
- PHP Data Objects
now i am going to create connection between php and Database
<?php
define('HOST','localhost');
define('USER','root');
define('PASS','');
define('DB_NAME','oop_login');
try{
$conn = new PDO("mysql:host=".HOST.";dbname=".DB_NAME, USER, PASS);
}
catch (PDOException $e){
exit("ERROR: ". $e->getMessage());
}
?>
firstly i define HOST
, USER
, PASS
, DB_NAME
and assign localhost
as server, root
as user, null or empty as password, and oop_login
as database name
then
try{
$conn = new PDO("mysql:host=".HOST.";dbname=".DB_NAME, USER, PASS);
}
and i use try
key word for make connection between php and database using $conn = new PDO("mysql:host=".HOST.";dbname=".DB_NAME, USER, PASS);
as new PDO
(PDO
- PHP Data Objects
)
if there are any errors while make connection between php and database it follow up content of catch
keyword
catch (PDOException $e){
exit("ERROR: ". $e->getMessage());
}
- start Project
- index.php
- css/style.css
- lib/layouts/header.php
- lib/layouts/footer.php
- lib/views/login.php
- lib/views/reg.php
- lib/function/function.php
- lib/function/config.php
- Github JehanKandy
- Twitter @JehanKandy
Copyright 2021–2023 JehanKandy. OOP Login released under the MIT License