Skip to content

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

$con = new mysqli("host","username","password","database");
echo $con ? 'connected' : 'not connected';
See also  Java code snippet - How to assign null to a variable ?

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.