Tekkishodan
Member
Morning Gents
I have added a PHP plugin to my list and have put the following code into the PHP box.
I want to run this code when I press the button on a row by row basis.
I know this code works as I have it inside the form when it is sumbitted.
My question is what do I use to identify the id value of the row I have clicked rather than {rowid}?
Ta
I have added a PHP plugin to my list and have put the following code into the PHP box.
I want to run this code when I press the button on a row by row basis.
I know this code works as I have it inside the form when it is sumbitted.
$user =$user =& JFactory::getUser();
$userid = $user->get('id');
$database =& JFactory::getDBO();
$sql = "Select sum(amount) from spend2013 where budget = {rowid}";
$database->setQuery($sql);
$val = $database->loadResult();
$sql = "Select annualamount from budget where id = {rowid}";
$database->setQuery($sql);
$amount = $database->loadResult();
$outstanding = $amount - $val;
if ($val==0)
{
$outstanding=$amount;
} else
{
$outstanding = $amount - $val;
}
$sql = "UPDATE budget SET `outstanding` = '" . $outstanding . "' where id = {rowid}";
$database->setQuery($sql);
$database->query();
My question is what do I use to identify the id value of the row I have clicked rather than {rowid}?
Ta