Discovering Which Extension Is Being Used : mysqli_connect « MySQL Database « PHP






Discovering Which Extension Is Being Used

 
<?php

  function mysqlinstalled (){
    if (function_exists ("mysql_connect")){
      return true;
    } else {
      return false;
    }
  }
  function mysqliinstalled (){
    if (function_exists ("mysqli_connect")){
      return true;
    } else {
      return false;
    }
  }
  
  if (mysqlinstalled()){
    echo "<p>The mysql extension is installed.</p>";
  } else {
    echo "<p>The mysql extension is not installed..</p>";
  }
  if (mysqliinstalled()){
    echo "<p>The mysqli extension is installed.</p>";
  } else {
    echo "<p>The mysqli extension is not installed..</p>";
  }
?>
  
  








Related examples in the same category

1.In PHP 5 using the MySQLi extension
2.MySQL Connection Test
3.function mysql_connect() establishes an initial connection with the MySQL server.
4.custom-error-messages.php