waby
Member
Hello,
I use this script to update a table in a php plugin in a form on "start on form submisson (onBeforeProcess)"
$soid = '{jml_fb_sw_swaps_from___sender_offer_id}';
$snum = '{jml_fb_sw_swaps_from___offered_number}';
$db =&JFactory::getDBO();
$db->setQuery("SELECT stock_number from jml_fb_sw_offers_stocks WHERE parent_id = $soid");
$sstock = $db->loadResult();
$sstockcalc = $sstock - $snum;
$squery = "UPDATE jml_fb_sw_offers_stocks SET stock_number = $sstockcalc WHERE parent_id = $soid";
$db->setQuery($squery);
$db->query();
Of course it works only with the first row of a repeatable group because I think I've to do an array / foreach but I don't know how.
Could you please provide me the right synthax ?
Eloise
I use this script to update a table in a php plugin in a form on "start on form submisson (onBeforeProcess)"
$soid = '{jml_fb_sw_swaps_from___sender_offer_id}';
$snum = '{jml_fb_sw_swaps_from___offered_number}';
$db =&JFactory::getDBO();
$db->setQuery("SELECT stock_number from jml_fb_sw_offers_stocks WHERE parent_id = $soid");
$sstock = $db->loadResult();
$sstockcalc = $sstock - $snum;
$squery = "UPDATE jml_fb_sw_offers_stocks SET stock_number = $sstockcalc WHERE parent_id = $soid";
$db->setQuery($squery);
$db->query();
Of course it works only with the first row of a repeatable group because I think I've to do an array / foreach but I don't know how.
Could you please provide me the right synthax ?
Eloise