I have discoved the apis to fix my problem. Its amazing that the solution was not posted on this fourm before. Seems like though this is a old framework it is not used by hard core coders who need more that what is offered by the addt gui. Through my own digging i was able to find a solution:
$result2 = $tNG->connection->execute("select idprd_pdt from fbs_product_pdt where idmnu_pdt = '".$result->Fields("idmnu_pdt")."' ");
$update = "update fbs_proddet_prd set image_prd = '$image_prd', make_default_image_for_this_category = 'Y'
where id_prd = '".$result2->Fields("idprd_pdt")."' ";
$result_update = $tNG->connection->execute($update);
$values .= $result2->Fields("idprd_pdt").",";
to find the classes and their function you can navigate to includes/common/lib/db/KT_Recordset.class.php