Question

Why does my mysqli::get_result function break?

Posted December 4, 2014 4.5k views

So i’ve looked all over for information about this, and I found something that says that mysqli::get_result doesn’t work for PHP 5.4 and below, but running phpinfo() says that im on 5.5. I’m running and Ubuntu LAMP server, and the whole code works just fine on my XAMPP on OSX. The following is the code in question:

<?php   
                if ($videos = $mysqli->prepare("SELECT htmlcode FROM content WHERE datatype = 'Video' AND username = ?")) {
                    $videos->bind_param('s',$_SESSION['username']);
                    $videos->execute();
                    $result = $videos->get_result();
                    while ($row = $result->fetch_array(MYSQLI_NUM))
                    {
                        foreach($row as $r) {
                            echo "$r";
                        }
                    }
                } else {
                        return false;
                }
            ?> 

Please help! Thanks.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

WELL, Resolved. I hope other people that run into this issue will see this.

I ran :

sudo apt-get install php5-mysqlnd

because php5-mysql does not support it. GOOD NEWS

Submit an Answer