How to Drop Table in phpMyAdmin
From the PHP script if you want to access the MySQL Database you have to first create a connection to the database server with the help of mysqli_connect mysqli function.
MySQL Examples in Both MySQLi and PDO Syntax
In this, and in the following chapters we demonstrate three ways of working with PHP and MySQL:
- MySQLi (object-oriented)
- MySQLi (procedural)
- PDO
MySQLi Installation
For Linux and Windows: The MySQLi extension is automatically installed in most cases, when php5 mysql package is installed.
Open a Connection to MySQL
Before we can access data in the MySQL database, we need to be able to connect to the server:
Example – 1 MySQLi Procedural Example
`
<?php
$server = "localhost";
$user = "root";
$password = "";
// Create connection
$connection1 = mysqli_connect($server, $user, $password);
// Check connection
if (!$connection1) {
die("The Connection is failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>
In the above example we show that how you can create a connection between database server and php server.

June 15th, 2019
Nilesh Chaurasia
Posted in
Tags:
