Wednesday, March 13, 2019

Check MySQL connectivity | Mysql Connection testing | PHP with mysql connection


<html>
   <head>
      <title>Connecting MySQL Server</title>
   </head>

   <body>
      <?php
         $dbhost = 'localhost';
         $dbuser = 'user';
         $dbpass = 'password';
         $conn = mysqli_connect($dbhost, $dbuser, $dbpass);

         if(! $conn ){
            die('Could not connect: ' . mysqli_error());
         }
         echo 'Connected successfully';
         mysqli_close($conn);
      ?>
   </body>

No comments:

Post a Comment