php - Trying to validate PayPal payment amount - MySQL IPN
Get the solution ↓↓↓Solution:
Usemysql_fetch_row()
to get the $amount_data.Mysql_query() returns only the resouce id
$amount_data = mysql_query ("SELECT * FROM subscriber WHERE payment_amount = '$payment_amount' AND id = '$id' ");
$row = mysql_fetch_row($amount_data);
echo $row[0];
Check the link http://php.net/manual/en/function.mysql-fetch-row.php
Answer
Solution:
This is what worked:
$payment_amount = mysql_real_escape_string($_POST['mc_gross']);
//$amount = mysql_query ("SELECT payment_amount FROM subscriber WHERE id = '$id'");
$amount_data = mysql_query ("SELECT * FROM subscriber WHERE payment_amount = '$payment_amount' AND id = '$id' ");
$row = mysql_fetch_row($amount_data);
if ($row[6] != $_POST['mc_gross']) {
$errmsg .= "'mc_gross' does not match: ";
$errmsg .= $_POST['mc_gross']."\n";
file_put_contents(dirname(__FILE__).'/logs/ipn.log',"\n###AMOUNT Don't MATCH Amount in Database='$row[6]' Amount in requested='$payment_amount' for id '$id'###\n",FILE_APPEND);
}
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: cannot set properties of undefined (setting '_dt_cellindex')
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.