MySql Database | MySQL Tutorial for Beginners
×

MySql Database ?

0 3256

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)

If we compare both of above PDO is more powerful than MySQLi because it can work on 12 different databases on the other hand MySQLi can only work with MySQL databases.


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:


Discount Coupons



Leave a Reply


Comments
    Waiting for your comments