Jump to content

mysql to mysqli


Scott123

Recommended Posts

change mysql to mysqli. mysql works fine. mysqli wont even start.in webserver/www/site/cms/index.php.// Connect to database, start session.require_once('../Access_Granted.php'); in webserver/www/site/Access_Granted.php. // Connect to database.require_once('../mysqli_connect.php'); in webserver/mysqli_connect.php.DEFINE ('DB_USER', 'peter'); DEFINE ('DB_PASSWORD', 'abc123'); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'content'); $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die('Could not create mysqli object'.mysqli->error());returns nothing to index.php, not even an error message. Just the previous code and text. Then nothin...I dropped in msqli code from a Zend tutorial, (it's database was built through php with msqli).one line before works also!I got a 'T-object expected' error when I connected with mysql, then switched to the 'new' mysqli object constructer.My project was built through php with mysql. A Mindleaders tutorial.I passed the Zend certification sample test but failed the real thing.So...I need to learn & apply mysqli, Then start again with PDO.3 days banging my brain. please, I need help!

Link to comment
Share on other sites

That's a little hard to understand. Consider writing in complete sentences, instead of things like "change mysql to mysqli." or "A Mindleaders tutorial.". If I'm understanding you correctly, apparently you're trying to use the mysqli extension but you're unable to. First, verify that the mysqli extension is being loaded. You can do that by using extension_loaded('mysqli') or by running phpinfo and checking the list of loaded extensions. If the extension is loaded, then first make sure you have error messages enabled and set to an appropriate level. You can do that with this code before you try to create the mysqli object:

ini_set("display_errors", 1);error_reporting(E_ALL);

If you aren't seeing error messages, after you create the object output it using var_dump($mysqli) and see what it says.

Link to comment
Share on other sites

Thankyou for your reply.I use error_reporting(E_ALL | E_STRICT ).Yes mysqli is installed.I've placed code for a different mysqli database in the line before the require_once in index.php, It works!But placing it in the first line of the required file(Access_Granted.php) fails.I've used Mindleaders content management tutorial to build a working mysql site.I've switched all the php code to mysqli then discover this problem.I get nothing from var_dump either. Could that have something to do with being built with mysql not mysqli,or because you can't create an object with require_once, calling an objectconstructer in a parent folder?I wish I had a clearer question. Thank-you for your patience.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...