Skip to content

PHP code snippet – How to check if is connected to database?

<?php
$con = new mysqli("host","username","password","database");
echo $con ? 'connected' : 'not connected';
?>
See also  How to change state of a Switch in Android?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.