Call to undefined method mysqli_stmt::get_result() |
Hi,
I totally do not understand why I am getting the error "Call to undefined method mysqli_stmt::get_result()" As I am not calling the function!!! The record IS inserted, but I do not understand why I am getting the error. Any ideas????? (full error attached). PHP Code: <?php namespace App\Models\User; (06-15-2020, 06:03 AM)68thorby68 Wrote: Hi,The docs say that $query->execute(); returns a result set, which is why the get_result() is being called. You could do this using: PHP Code: class Register extends Model {
Thank you Ryan, but I need to use prepared queries as I have a number of queries that update multiple tables. Therefore a rollback option is preferable going forward.
And yes the documentation says (and if you follow the error, you can see) get_result() is being called. But why, if you follow the documentation and run the prepared query to spec, does get_result() give an error? I would understand errors if the function was called incorrectly, but when executing the prepared query to spec I would not expect this to happen. And, I have tried every which way, using all of the example types. I can only really conclude that either prepared queries DO NOT WORK, or the documentation is WRONG. This said, many thanks for your suggestion.
For everyone coming directly into this thread (answered this question in another thread by OP).
mysqli_stmt_get_result are only available with mysqlnd driver. CodeIgniter 4 - Server Requirements
Sorry jreklund. This doesnt make sense.
The ci4 prepared query implicitly calls mysqli_stmt_get_result. This is not something explicitly called in my code. Therefore I'm assuming there is something wrong with the ci4 prepared query or (as I am executing to the letter of the documentation) I am totally missing the point (which is not rare!). and I have checked my php config: mysqlind is alive and well :-) (attached)
mysqli_stmt_get_result get's called by execute, so that you get access to the result object, based on your prepared statement.
You need to disable mysqli and enable nd_mysqli instead. It's under a different name with Cpanel, because reasons.
sorry I might be a bit stupid here. But when I run execute in the prepared query I get error "Call to undefined method mysqli_stmt::get_result()"
so my thinking is: My server meets the requirements my data is good I have prepared statement as per docs I have executed the statement as per the docs But execute is generating the error, and for the life of me I dont know why? :-) The prepared query is erroring out on itself? Not becuase i'm get_results() explictly or i'm calling get_results() incorrectly.
As it currently stands, your server does not meet the requirements. mysqli don't include all features, nd_mysqli does.
nd_mysqli where added as a replacement for mysqli, so that compatibility could be kept with older PHP versions. https://cloudlinux.zendesk.com/hc/en-us/...D-vs-MySQL-
Thank you so much.
I have updated my server... I had to disable: mysqli pdo_mysqli and enable nd_mysqli ng_pdo_mysqli I am hopeful this will also iron out other issues I have been experiencing across the framework, and if it does I will update the approriate threads. Not wanting to sound like a broken record, but some reference to this in the documentation would have saved me a couple of days, and you having to read/reply my boring threads. Again, many thanks for your help and patience. |
Welcome Guest, Not a member yet? Register Sign In |