auto insert query in function table_init()
Posted: 2021-10-06 05:47
dear teams,
what wrong with my code
i want to auto insert when go table_view.php
so i go hooks/table.php and i wrote this code
function debit_init(&$options, $memberInfo, &$args) {
$db = db_link();
$db->autocommit(FALSE); // Important
$db->query("INSERT INTO debit (date)
SELECT invoices.date FROM invoices WHERE not exists
(select debit.date from debit where debit.date=date(invoices.date) group by date(invoices.date))
group by date(invoices.date)");
$db->autocommit(TRUE); // Important!
return TRUE;
}
this query was correct when i check in my database mysql
but function _init() is not working
what wrong with my code ?
please help me
i'm trying to get acquainted with appgini code
what wrong with my code
i want to auto insert when go table_view.php
so i go hooks/table.php and i wrote this code
function debit_init(&$options, $memberInfo, &$args) {
$db = db_link();
$db->autocommit(FALSE); // Important
$db->query("INSERT INTO debit (date)
SELECT invoices.date FROM invoices WHERE not exists
(select debit.date from debit where debit.date=date(invoices.date) group by date(invoices.date))
group by date(invoices.date)");
$db->autocommit(TRUE); // Important!
return TRUE;
}
this query was correct when i check in my database mysql
but function _init() is not working
what wrong with my code ?
please help me
i'm trying to get acquainted with appgini code