note 43868 added to function.mysql-connect

From: Date: Tue, 06 Jul 2004 21:02:07 +0000
Subject: note 43868 added to function.mysql-connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-72794@lists.php.net to get a copy of this message
There's a stupid behavior with this function when you use a blank server argument. Something like print mysql_connect("","",""); will print 1. So if you plan of doing an application that can connect to anything the user enter, and wan't to be sure that the connection is properly set, this kind of check is usually the best thing to do: if ($link = mysql_connect($server, $user, $pass) and $server != "") { # I'm connected ! } ---- Manual Page -- http://www.php.net/manual/en/function.mysql-connect.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43868 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43868&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43868&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#72794) next »