3

Possible Duplicate:
Call to undefined method mysqli_stmt::get_result

My web host has PHP 5.3.10 and I'm using mysqli, but some functions like get_result() doesn't work because it needs mysqlnd.

I made some tests and appears that mysqlnd isn't used. Is possible to enable it or is needed to reinstall PHP (I can't do this because is a web hosting).

I don't want to change my code to work without it.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Renato Dinhani
  • 35,057
  • 55
  • 139
  • 199
  • 1
    @Repox Is not duplicate, I think. I already saw that question, but it doesn't answer what I asked here. That question pointed me the problem. – Renato Dinhani May 17 '12 at 18:41
  • The problem is the same and a solution has been given (which means you can't fake or simulate the get_result() method in resource object). – Repox May 17 '12 at 18:43
  • 2
    Why was this closed as a duplicate? It's not (although this is a progression from the previous one). The previous question was "Why can't I use `mysqli_stmt::get_result`?", and the answer was "You need to enable mysqlnd to use it." This question is "How do I enable mysqlnd?" There is zero overlap between the scope of the answers given to the previous question and the scope of this question; the mention of `get_result` in this question is only there because it was the answer to the previous question that led the poster to ask this one. – Mark Amery Jan 25 '13 at 13:06
  • I had this same question. It was answered here but not in the "duplicate" question. Why is this considered a duplicate? – Mahks Mar 09 '13 at 01:36
  • 1
    https://stackoverflow.com/a/52955565/6094503 solved my problem – navid Sep 14 '20 at 08:46

1 Answers1

9

mysqldnd is a library that provides MySQL-connectivity to mysql_*, mysqli_* and PDO functions/methods.

Those three extensions are compiled either with mysqlnd, or with libmysql ; and cannot be compiled using both at the same time : they use one library, or the other.
This means the only way to switch between libmysql and mysqlnd is to re-compile PHP (or, at least, the mysqli extension, in your case) ; or to install a version of it that is compiled against the library you want.

Basically, this can only be done by the administrator of your server -- so, in your case, you seem to be stuck with libmysql ; even if it lacks some interesting features.


Once again, using an hosting service with which you are not administrator has advantages (less maintenance for you, you probably pay less), but you are not able to do whatever you want with "your" server.

Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
  • 4
    Seems I can't add an answer, so it has to be a comment. If your webhosting has cpanel it may have a "select PHP version" option. It did in my hosting Cpanel and in the Php Selector you can choose the extensions. I unchecked the mysql, mysqli, pdo_mysql extensions and checked the nd_mysql, nd_mysqli, nd_pdo_mysql, and myslqnd extensions. This enabled MySQLnd. I can find no documentation for this hence it may not be 100% correct of which extensions need to be checked but I'd like the info to be available here as I couldn't find any info on it anywhere else – Nat May 20 '16 at 17:23
  • 1
    @Nat You did a great job by leaving a very useful comment here. It worked like a charm for me! Thanks. – Tariqul Islam Nov 16 '20 at 09:43