get_result() Doesn't Work even mysqlnd is enabled
Asked Answered
B

3

6

It might be a duplication of many questions however i dont seem to get my answer from any of the questions present.I am using multi domain linux hosting provided by hostgator.I tried to use mysqli_stmt_get_result() but it throws me an error stating as anundefined method.I contacted the hostgator admin panel and they enabled the mysqlnd extension for me.I do see the mysqlnd extension enabled in phpinfo of my website.However i still see the same error.

$mysqlnd = function_exists('mysqli_stmt_get_result');

if ($mysqlnd) {
    echo 'mysqlnd enabled!';
}
else
   var_dump("nope");

I tried to check if it is enabled or not , it says nope but i do see mysqlnd as enabled in my phpinfo.

What is the problem and how can i solve this one ? Plus using with any other method is not an option because i have already coded the whole project using mysqli_stmt_get_result().

Update:

Mysqli

mysqlnd

Query:

 $stmt=$this->link->prepare("SELECT `Session_Data`,`ip_address` FROM Session WHERE `Session_Id` = ? AND `Session_Expires` > '".date('Y-m-d H:i:s')."'");

        $stmt->bind_param("s",$id);
        $stmt->execute();
         $res=$stmt->get_result();
Buttermilk answered 19/4, 2016 at 15:37 Comment(14)
Need to show the actual query and get_result code.Legion
Your descriptions are kind of vague and your sample code only tests for a a function that does not exist at all. Can you see mysqlnd in the Client API library version row of the mysqli table? Can you see mysqli in the API Extensions row of the mysqlnd table?Phew
@Legion wait i will update my postButtermilk
Ok, my comment wasn't so wrong. php.net/manual/de/mysqlnd.plugin.php mysqlnd is just a plugin to work between MySQLi or PDO and MySQL. You still need either one of those extension.Chargeable
@ÁlvaroGonzález see the question.I have updated the question with the relevent things you asked forButtermilk
Uh, eh php.net/… The function you are looking for doesn't exist at all.Chargeable
The mysqlnd driver appears to be on the server but I'd say it isn't configured to work with any extension.Phew
@ÁlvaroGonzález how would i achieve that?Buttermilk
Just seen your last edit: you want mysqli_stmt_get_result!Phew
@CharlotteDunois updated my question anywaysButtermilk
Perhaps you need be more specific when you talk to Hostgator support. You have to explain you want to use mysqli_stmt_get_result so you need the mysqlnd driver configured to work with the mysqli extension.Phew
@CharlotteDunois fine?Buttermilk
@ÁlvaroGonzález sure i will ask them to do so.Let me see what they sayButtermilk
@CharlotteDunois php.net/manual/en/mysqli-stmt.get-result.phpTom
B
30

To make this thing work, Enable nd_mysqli in php extensions and disable mysqli. This will work like charm!

Buttermilk answered 19/4, 2016 at 16:24 Comment(9)
how did you do that through cpanel?Caro
@Caro Cpanel->Select PHP version(This might be under software tab)->You will see modules there.You can check uncheck any module you want to,as well as you can change your php version.Hope, this might help.Buttermilk
Is there a way to enable it and keep mysqli active aswell?Altitude
i tried doing that but cpanel doesn't allow it and nd_mysqli is the same as mysqli, i have kept it active while unchecking mysqli , till this day i have not faced any thing that worked on mysqli and not on nd_mysqli.Buttermilk
I did this after fiddling around but for some reason, although the errors have gone, no database results seem to be returning :/ PHP 7.0 / 7.1Straitjacket
Wow what an answer. superb answer same my lot of time to debug into serverVitellus
@Straitjacket debug your code , might be some logical error.Buttermilk
@BOTJr. I upgraded my server to PHP 7.4 and it broke my queries. After relentless searching all day and all night with answers stating to use another function or functions; that didn't seem to work in my situation I find this and it worked wonders!! Thank you good sir! +1Alpinist
In my case, i had to uncheck "mysqli" first before i could enable "nd_mysqli"Juback
S
3

Go to Cpanel ->PHP version under software section and change the options as below enable nd_mysqli enter image description here

Spelunker answered 24/11, 2018 at 15:3 Comment(0)
D
0

Yes It worked with nd_mysqli option selected. Thanks @BOTJr. It also shows 'nd_mysqli skipped as conflicting' as an warning so no need to worry just disable mysqlnd, mysqli and then enable again nd_mysqli option. It will work fine.

Donohue answered 25/11, 2019 at 11:43 Comment(2)
If you want to improve an answer edit that or make your answer more clear by formatting properlyBreccia
You do not need to disable mysqlnd in order to enable nd_mysqli. You just have to disable mysqli.Alpinist

© 2022 - 2024 — McMap. All rights reserved.