Skip to content

Instantly share code, notes, and snippets.

@chenshaoju
Last active July 26, 2019 07:18
Show Gist options
  • Save chenshaoju/fb30a049f86b47d36f688280899e5b8b to your computer and use it in GitHub Desktop.
Save chenshaoju/fb30a049f86b47d36f688280899e5b8b to your computer and use it in GitHub Desktop.
In php,Check MySQL working or not.
<?php
$link=mysql_connect("SERVER_ADDRESS","MYSQL_USERNAME","MYSQL_PASSWORD");
if($link) echo "OK";
else header('HTTP/1.1 500 Internal Server Error');
?>
<?php
$link=mysqli_connect("SERVER_ADDRESS","MYSQL_USERNAME","MYSQL_PASSWORD");
if($link) echo "OK";
else header('HTTP/1.1 500 Internal Server Error');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment