0

I moved my php code to a new hosting which missing mysql_nd and a have more than 150 functions that use stmt->get_result() and fetch_assoc.

Is there a function that can do the same work of stmt->get_result() and fetch_assoc and give the exact results so I can fix the problem without having to modify all the functions?

Al Foиce ѫ
  • 4,195
  • 12
  • 39
  • 49
Christian
  • 164
  • 1
  • 10
  • 1
    `mysql_*` functions were deprecated in php5 and removed in php7 - switch to pdo – treyBake Sep 04 '19 at 13:07
  • Are you saying you downgraded your PHP version? Why? I would stay away from such hosting. – Dharman Sep 04 '19 at 13:10
  • Note that [`mysqlnd`](https://www.php.net/manual/en/book.mysqlnd.php) is not the same as `mysql`. If the server does not have PHP compiled with `mysqlnd` and the hosting server won't install it for you, then you'll have to either deal with the existing non-mysqlnd functions, or switch to PDO. However, I think you should be able to use `fetch_assoc` even without `get_result` – aynber Sep 04 '19 at 13:11
  • What kind of functions do you have for getting results using `mysqlnd` ? I always thought that `mysqlnd` was at a lower level than `mysqli` – apokryfos Sep 04 '19 at 13:12
  • @apokryfos I'm getting the error: Call to undefined method mysqli_stmt::get_result – Christian Sep 04 '19 at 13:13
  • Update to a proper PHP version and you won't have this problem. – Dharman Sep 04 '19 at 13:18
  • 1
    https://www.php.net/manual/en/mysqli-stmt.get-result.php#113398 has a solution for that – apokryfos Sep 04 '19 at 13:20
  • @apokryfos Yikes! This comment was posted 5 years ago. There should be no reason to use such nasty solutions anymore. – Dharman Sep 04 '19 at 13:23
  • @Dharman I am using php 7.2 in the old and new hosting – Christian Sep 04 '19 at 13:25
  • 1
    You need to ask your hosting provider then, because something must be misconfigured on your server. – Dharman Sep 04 '19 at 13:29

1 Answers1

-1

You have two choices. The first is to contact your provider indicating that you need MySql Native Driver. The second is to review all your code as a PDO or alternatively MySqli (PDO Council). In terms of time, with the second option we invest a little more, but for sure you will make your application more stable and secure. I would personally use it for the second hypothesis.

Stefano Pascazi
  • 363
  • 1
  • 11