RE: [PHP-DB] $db=new mysqli fails while $db=mysqli_connect succeeds in PHP/MySQL

From: Date: Mon, 27 Aug 2007 14:15:56 +0000
Subject: RE: [PHP-DB] $db=new mysqli fails while $db=mysqli_connect succeeds in PHP/MySQL
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-43949@lists.php.net to get a copy of this message
From a php-general thread earlier: <?php $db=new mysqli('localhost','whil','secret','test'); ?> generates: Fatal error: Call to undefined function new mysqli() in index.php on line 24 while <?php $conn = mysqli_connect("localhost","whil","secret","test"); echo 'conn good: '.$conn.' :very good indeed<br>'; ?> generates success: conn good: Object id #1 :very good indeed The book I'm working with (PHP & MySQL Web Dev, Welling/Thompson) specifically defines the 'new mysqli' syntax. So I'm guessing I don't have something configured right? Whil
I don't see a constructor for mysqli at http://php.net/mysqli Your book is probably defining a class that you didn't include/require. For example, search for the following at the php page above: require_once('safe_mysqli.php'); try { $mysql = new safe_mysqli You will need to have the class your book is defining before you can instantiate such an object. _________________________________________________________________ Find a local pizza place, movie theater, and more….then map the best route! http://maps.live.com/default.aspx?v=2&ss=yp.bars~yp.pizza~yp.movie%20theater&cp=42.358996~-71.056691&style=r&lvl=13&tilt=-90&dir=0&alt=-1000&scene=950607&encType=1&FORM=MGAC01

« previous php.db (#43949) next »