How to Connect MySql database using php?

How to Connect MySql database using php?

  • July 04, 2020
  • PHP

You can connect MySql database using PHP with the following code:

  <?php $con = mysqli_connect("localhost","root","","jtable");
  if (mysqli_connect_errno()) {
         echo "Failed to connect to MySQLi: " . mysqli_connect_error();
         exit();
   }
   ?>