-1

The code below works on my localhost but it doesn't when I make the system live. Any ideas?

Fatal error: Call to undefined method mysqli_stmt::get_result() in /home/.../public_html/test/users.php on line 120

<?php        
        $connection=mysqli_connect("host", "username", "password", "database");
        $sql="SELECT COUNT(*) from database_users";
        $stmt = $connection->prepare($sql);
        $stmt->execute();
        $res = $stmt->get_result();
        $users = $res->fetch_array(MYSQLI_ASSOC);

        if ($users['COUNT(*)'] < 4) {
    ?>

        // html goes here, outside of the php tags

    <?php
        } else {

            echo "Sorry, you have reached the user account limit.";

        };
    ?>
CharlieW95
  • 1
  • 1
  • 4
  • $res = $stmt->get_result(); @Prakash – CharlieW95 Feb 26 '14 at 14:17
  • That's odd, since apparently it does recieve a mysqli_stmt object. However without the get_result method. That's just weird. What PHP version are you using on your host ? – Tularis Feb 26 '14 at 14:18
  • Hi Tularis, its version 5.3.27 @Tularis – CharlieW95 Feb 26 '14 at 14:19
  • This is the 5th time you've posted this question http://stackoverflow.com/questions/22042820/php-limit-registration-on-form-to-a-certain-amount-of-users-hide-show-form, http://stackoverflow.com/questions/22028881/php-limit-registration-on-form-to-a-certain-amount-of-users, http://stackoverflow.com/questions/22009209/limit-registration-to-4-people-on-form-sign-up, http://stackoverflow.com/questions/21991196/code-to-limit-user-registration-hide-show-form-php – Mike B Feb 26 '14 at 14:29

2 Answers2

0

Apparently, your server does not have the mysqlnd driver installed. Without it, the MySQLi extension's mysqli_stmt object does not have a get_result method.

Install the mysqlnd driver on the server to resolve this problem.

More information can be found in the PHP manual

Tularis
  • 1,506
  • 1
  • 8
  • 17
0

You need Install the mysqlnd driver on the server to resolve this problem.

you can find more information in the PHP manual This should resolve the issue.

Superman2013
  • 41
  • 10