I have the following code:
$statement = $mysqli->prepare("INSERT INTO `paypal_transactions` (`txn_id`, `payer_email`, `mc_gross`, `mc_currency`, `expires`, `userid`) VALUES (?, ?, ?, ?, " . (time() + 2678400) . ", ?)");
file_put_contents('error.txt', $mysqli->error . mysqli_error($mysqli));
$statement->bind_param('ssdsi', $txn_id, $payer_email, $payment_amount, $payment_currency, $userid);
$statement->execute();
error.txt is blank every single time, and this is what I see in the error_log file:
[02-Jul-2013 09:08:15 America/Denver] PHP Fatal error:
Call to a member function bind_param() on a non-object in /home4/site/public_html/paypal.php on line 96
which is referring to the block of code above.
I am at my wits end with this, I have been trying to fix it for hours and it just won't work. I cannot find any problems with my sql query and I am losing my mind trying to figure out what's wrong.
It seems
$statement = $mysqli->prepare(..)
give resultFALSE
so$statement
is not object and you can't use$statement->bind_param(..)
PHP - MySQLi - prepare
BTW: Have you test your SQL query directly in database by copy/paste ?
Don't use MYSQL keywords in $mysqli->prepare,for example:from,select etc. So,your datatables fields name are important!Please checking