MySql Database ?
0 7047
MySQL is a cross platform software means it run on all platforms like Linux, Unix and Windows. MySQL is a database software and normally its used on web servers. It is fast, user friendly and open source like PHP (Hypertext Preprocessor). Anyone can download and use it freely.
PHP and MySQL is use for Dynamic Website Development and both have good combination.
We have two ways to work with MySQL database:
- MySQLi extension (the "i" stands for improved)
- PDO (PHP Data Objects)
MySQLi has two different approaches:
- MySQLi (object-oriented)
- MySQLi (procedural)
Example: MySQLI (object-oriented)
<?php
$connection = new mysqli(localhost, username, password) or die ("Server not connected);
?>
// if credentials are ok, then returns nothing value, if credentials are wrong, then message should be print "Server not connected".Example: MySQLi (procedural):
<?php
$connection = mysqli_connect("host", "username", "password","databasename") or die ("Server not connected");
if($connection){
echo "connected successfully";
}
?>
Share:





Comments
Waiting for your comments