I am facing a problem. I have made payment through paypal. After payment when it redirect to my website, i have a code which update the value in database. But when i refresh the same page, it automatically update its value. I only want to update value only on making a payment not on refreshing. I am using the code
$db = JFactory::getDBO();
$result = null;
$user = JFactory::getUser();
if ($user->guest) {
return false;
}
$query = 'SELECT credit' .
'FROM #__vodes_credits' .
'WHERE userid = ' . (int) $user->id;
$db->setQuery($query);
$result = $db->loadResult();
$result_final = $result+20;
$query = 'update #__vodes_credits SET credit='.$result_final.
'WHERE userid = ' . (int) $user->id;
//echo $query;
$db->setQuery($query);
$result = $db->loadResult();
if ($db->getErrorNum()) {
JError::raiseWarning( 500, $db->stderr());
}
return $result;
$app = JFactory::getApplication();
$app->redirect("localhost/Joomla/");
Please help me to sought it out.