27 February 2022

Create data base in php

Create data base in php




here is your Code:

<?php
$servername = "localhost";
$username = "root";
$password = "";
try {
    $conn = new pdo("mysql:host=$servername"$username$password);
    $conn->setAttribute(pdo::ATTR_ERRMODE, pdo::ERRMODE_EXCEPTION);
    $sql = "CREATE database account";
    $conn->exec($sql);
    echo "database account create successfully";
catch (PDOException $e) {
    echo $sql . "<br>" . $e->getMessage();
}
$conn = null;



here, we create data base in php and run on localhost if database create  the localhost will show connect successfully message

if you have still doubt please see out video:





1 comment:

If You have any doubt, or want to know about something, please let me know

how to create custom plugin deactivate hook and display all post in wordpress?

 how to create custom plugin deactivate hook and display all post in wordpress? make new folder in plugin after whatever you want your folde...