Erik_Fischer Posted February 3, 2014 Share Posted February 3, 2014 (edited) I just moved all of my website files and databases over to a webhost and I've run into the following error when trying to run one of my pages: Call to undefined method mysqli_stmt::get_result() I saw this problem before and it had something to do with the mysqlnd driver not being installed. So I contacted the web host and they said that both mysqli and mysqlnd were installed by using the following PHP: <?php if (extension_loaded('mysqlnd')) echo 'extension mysqlnd is loaded'; // WORKED if (extension_loaded('mysqli')) echo 'extension mysqli is loaded'; // WORKED ?> And here's the PHP I'm trying to run: <?php $cxn = mysqli_connect("localhost", "my_username", "my_password", "my_database") or die ("Couldn't connect to the server. Please try again."); $id = 0; $stmt = $cxn->prepare('SELECT value FROM test WHERE id = ?'); $stmt->bind_param('i', $id); $stmt->execute(); $result = $stmt->get_result(); echo $result->num_rows; ?> Please help! Edited February 3, 2014 by Erik_Fischer Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted February 3, 2014 Share Posted February 3, 2014 (edited) just because the mysqlnd driver is present, doesn't mean php was built to use it, there's a configure switch to get mysqli to use the mysqlnd driver (required with php5.3, built in with php5.4+.) to test if you can use the fetch_all statement - if(function_exists('mysqli_fetch_all')) edit: here's a dynamic way of using the most efficient retrieval method that is available in your php installation - http://forums.phpfreaks.com/topic/282959-odd-behaviour-on-webhost-server/?do=findComment&comment=1453950 Edited February 3, 2014 by mac_gyver Quote Link to comment Share on other sites More sharing options...
Erik_Fischer Posted February 3, 2014 Author Share Posted February 3, 2014 just because the mysqlnd driver is present, doesn't mean php was built to use it, there's a configure switch to get mysqli to use the mysqlnd driver (required with php5.3, built in with php5.4+.) to test if you can use the fetch_all statement - if(function_exists('mysqli_fetch_all')) edit: here's a dynamic way of using the most efficient retrieval method that is available in your php installation - http://forums.phpfreaks.com/topic/282959-odd-behaviour-on-webhost-server/?do=findComment&comment=1453950 I ran the fetch_all statement and it came back as false. What should I do to get mysqlnd working now that we know this? Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted February 3, 2014 Share Posted February 3, 2014 everything is explained in the documentation - http://us1.php.net/manual/en/mysqlnd.install.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.