note 90557 added to mysqli.connect

From: Date: Tue, 28 Apr 2009 08:47:57 +0000
Subject: note 90557 added to mysqli.connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-153893@lists.php.net to get a copy of this message
Note that both "mysqli_connect" and "mysqli::__construct" produce a warning when bad credentials are used (just like the old mysql_ functions I think), so you are forced to use @ to silence these, and then check for connect_error: <?php $c = @new mysqli( $dbHost, $dbUser, $dbPass, $dbName ); // OR @mysqli_connect( $dbHost, $dbUser, $dbPass, $dbName ); if ( $c->connect_error ) // this only works in PHP >= 5.2.9 // OR if ( mysqli_connect_error() ) ?> ---- Server IP: 83.137.20.135 Probable Submitter: 83.87.144.47 ---- Manual Page -- http://www.php.net/manual/en/mysqli.connect.php Edit -- https://master.php.net/note/edit/90557 Del: integrated -- https://master.php.net/note/delete/90557/integrated Del: useless -- https://master.php.net/note/delete/90557/useless Del: bad code -- https://master.php.net/note/delete/90557/bad+code Del: spam -- https://master.php.net/note/delete/90557/spam Del: non-english -- https://master.php.net/note/delete/90557/non-english Del: in docs -- https://master.php.net/note/delete/90557/in+docs Del: other reasons-- https://master.php.net/note/delete/90557 Reject -- https://master.php.net/note/reject/90557 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#153893) next »