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
auto insert query in function table_init()
auto insert query in function table_init()
Last edited by amyat on 2021-10-06 05:55, edited 1 time in total.
Re: auto insert query in function table_init()
If table name equals "debit" then filename should be hooks/debit.php, not hooks/table.php
Did you check your SQL command in your SQL tool (like phpMyAdmin or Adminer)?
Is there a reason why you are not using AppGini's built-in function sql("...", $error)?
Did you check your SQL command in your SQL tool (like phpMyAdmin or Adminer)?
Is there a reason why you are not using AppGini's built-in function sql("...", $error)?
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: auto insert query in function table_init()
hi jsetzer,
thanks for fast reply
filename is hooks/debit.php
sql query is working on my database when test on mysql (xampp database)
first , i need to lean appgini's built-in function
sry
how to write insert query in function _init()
thanks for fast reply
filename is hooks/debit.php
sql query is working on my database when test on mysql (xampp database)
first , i need to lean appgini's built-in function
sry
how to write insert query in function _init()
Re: auto insert query in function table_init()
Him
just an idea.
I have not seen "$db->autocommit(FALSE);" yet.
So you turn off autocommit, and turn it on later on again - ok ... but do you commit your SQL at some point in between?
I can not find any command that looks like you do.
Thus - as you do not commit, no SQL is executed
Olaf
just an idea.
I have not seen "$db->autocommit(FALSE);" yet.
So you turn off autocommit, and turn it on later on again - ok ... but do you commit your SQL at some point in between?
I can not find any command that looks like you do.
Thus - as you do not commit, no SQL is executed
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: auto insert query in function table_init()
thank you appgini team
Insert query is working on calculated file
just i want to auto insert date when another table have this date
no need to go write in ( function _init())
I got what i want
but need reload page sometime
now just i need to hide (add new button,save button,update button)
i like appgini ,i want to request "please update bootstrap3.x to last"
Insert query is working on calculated file
just i want to auto insert date when another table have this date
no need to go write in ( function _init())
I got what i want
but need reload page sometime
now just i need to hide (add new button,save button,update button)
i like appgini ,i want to request "please update bootstrap3.x to last"
Re: auto insert query in function table_init()
Code: Select all
$sql = "YOUR SQL COMMAND HERE";
$error = null;
sql($sql, $error);
if ($error) die($error);
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools