2

I get this error message:

Fatal error: Call to undefined method mysqli_stmt::get_result() in /../../public_html/index.php on line 76

for this script:

//evenement ophalen
if($stmt = $connection->prepare('
SELECT 
    id,
    eetdatum,
    inschrijdatum,
    maaltijd,
    kostprijs,
    extra
FROM 
    maaltijden
WHERE
    eetdatum >= ?
ORDER BY
    eetdatum
    ')){
$stmt->bind_param('s', $vandaag);
$stmt->execute();
$result = $stmt->get_result();
$evenement = $result->fetch_assoc();
}
elseif($connection->error) {
echo "Er gaat iets mis: " . $connection->error;
}

The server runs on php 5.5 and has the mysqlnd driver installed. What other problem could there be with this script?

I don't think this question is a duplicate, I don't need a work around, I can find this everywhere on this forum. I would like to know what could be wrong.

Coolen
  • 168
  • 2
  • 21
  • 2
    Possibly duplicated [http://stackoverflow.com/questions/8321096/call-to-undefined-method-mysqli-stmtget-result](http://stackoverflow.com/questions/8321096/call-to-undefined-method-mysqli-stmtget-result) – Kenny Lajara Feb 07 '16 at 17:11
  • 1
    Exactly what does `echo $connection->client_info;` (e.g. before the ->prepare line) print? – VolkerK Feb 07 '16 at 17:23
  • @Jack Smith ....and then what? – VolkerK Feb 07 '16 at 17:25
  • So ...you suggest not to use the prepared statement at all? Why? – VolkerK Feb 07 '16 at 17:28
  • @VolkerK I added the line, the result is: 10.0.23-MariaDB – Coolen Feb 07 '16 at 17:31
  • 1
    That doesn't look like the mysqlnd driver, which would report somewhat like `mysqlnd 5.0.12-dev - 20150407 - $Id: 7e72f9690b1498a1bead7a637c33a831c0d2f655 $` – VolkerK Feb 07 '16 at 17:32
  • phpinfo is giving this: mysqlnd enabled Version mysqlnd 5.0.11-dev - 20120503 - $Id: 15d5c781cfcad91193dceae1d2cdd127674ddb3e $ – Coolen Feb 07 '16 at 17:33
  • How did you install the mysqli extension? On what OS? – VolkerK Feb 07 '16 at 17:43
  • I did not install anything, this is a free hosting service, for a boyscout group. – Coolen Feb 07 '16 at 17:52
  • And what does phpinfo() say about a) the `Client API library version` in the mysqli section and b) the `API Extensions` in the mysqlnd section? I guess the extension doesn't "belong" to the php core, i.e. though there is a mysqlnd driver available, the mysqli extension has been compiled with libmysql support (and not mysqlnd). – VolkerK Feb 07 '16 at 22:53

1 Answers1

2

Sorry can't make a comment:

try adding this to your website: it will show if the driver is realy enabled:

$mysqlnd = function_exists('mysqli_fetch_all');

if ($mysqlnd) {
echo 'mysqlnd enabled!';
}else
{
echo 'mysqlnd not enabled!';
}
Aurianna
  • 76
  • 12
  • Thanks, the script is telling me that mysqlnd is not installed, but how is it possible that the phpinfo it telling me that it is installed? – Coolen Feb 07 '16 at 17:53
  • 1
    I have same issue. phpinfo says it is on but script said it is not enabled. – Hardik Shah Sep 12 '17 at 08:35