Can EARNING vodes be implemented with this code?

13 years 11 months ago #3358 by serge06
I was just wandering if users can earn vodes by posting a message on a Fireboard or SMF forum, or using other components. Would this code work with the "+1" in the $sql = "UPDATE #__vode_credits SET credit=credit+1 WHERE userid='$uid'";

<?php
class Vodes {
function Vodes(){}

function getVodes( $uid ){
$database =& JFactory::getDBO();
$sql = "SELECT credit FROM #__vode_credits WHERE userid='$uid'" ;
$database->setQuery( $sql );
$balance = $database->loadResult();
return $balance ? $balance : 0;
}

function updateVodes( $uid ){
$database =& JFactory::getDBO();
echo $uid;
$sql = "UPDATE #__vode_credits SET credit=credit+1 WHERE userid='$uid'";
$database->setQuery( $sql );
if( !$database->query()) return false;
return true;
}
}
?>

Please Log in or Create an account to join the conversation.

13 years 11 months ago #3359 by Saka
Yes, something like that should work.

Emir Sakic
www.sakic.net

Please Log in or Create an account to join the conversation.

About us

We provide high quality Joomla components created by a co-founder and original core developer of Joomla. For over a decade, our products have been used by more than 20.000 webmasters around the world.

We also recommend

Twitter

sakicnet: RT @LTmujo: @Ridjobrki ma jel to prinova na putu ili su ti oni dani u mjesecu? nek je sa srecom, da jos 10 puta toliko docekate u zdravlju… 88 days ago from Twitter for iPhone

Stay in touch