Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binding parameters with MySQLi throws "undefined method" error?

I have this code:

$dateInt = intval($date);
$stmt = $this->db->prepare('SELECT * FROM establecimientos WHERE timestamp > ?');
$stmt->bindParam($dateInt);
$stmt->execute();

And I'm receiving this error:

Call to undefined method mysqli_stmt::bindParam()

I'm sure there's something terribly wrong, but I cannot certainly know!

like image 637
Ramon Avatar asked Dec 18 '25 04:12

Ramon


1 Answers

You have 2 mistakes. The bind_param method requires a datatype hint as the first parameter and it is bind_param and not bindParam

$stmt->bind_param('i', $dateInt);

Check the Documentation

like image 67
RiggsFolly Avatar answered Dec 20 '25 17:12

RiggsFolly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!