Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Save into two database name
-
- Posts: 19
- Joined: Tue Oct 02, 2018 5:29 am
Save into two database name
Hi
How can i save a form into two database in one form,
For example, i create a form with items name (the database table name is items) it contain name and stock, but the stock is readonly with numberformat
and i create a form with stock name (he database table name is stock) it lookup the items name and i can fill the stock there
The question is, how can i save the items database table name and stock database table name in the same time?
How can i save a form into two database in one form,
For example, i create a form with items name (the database table name is items) it contain name and stock, but the stock is readonly with numberformat
and i create a form with stock name (he database table name is stock) it lookup the items name and i can fill the stock there
The question is, how can i save the items database table name and stock database table name in the same time?
Re: Save into two database name
yusa82,
Maybe you could show some screenshots.
Steven
Sorry but I don't understand.How can i save a form into two database in one form,
Maybe you could show some screenshots.
Steven
-
- Posts: 19
- Joined: Tue Oct 02, 2018 5:29 am
Re: Save into two database name
Thank you for the reply
Here is the screenshots
The items form only contain code item, item name and stock(readonly)
The stock form contain date, subform with lookup of the item and contain QTY to update the stock
how can i save and update the total QTY and stock from the different table name
Here is the screenshots
The items form only contain code item, item name and stock(readonly)
The stock form contain date, subform with lookup of the item and contain QTY to update the stock
how can i save and update the total QTY and stock from the different table name
You do not have the required permissions to view the files attached to this post.
Re: Save into two database name
yusa82,
You can run PHP to do this after a Form saves.
These might help.
https://wiki.nubuilder.cloud/ ... s#PHP_Code
https://wiki.nubuilder.cloud/ ... Procedures
Steven
You can run PHP to do this after a Form saves.
These might help.
https://wiki.nubuilder.cloud/ ... s#PHP_Code
https://wiki.nubuilder.cloud/ ... Procedures
Steven
-
- Posts: 19
- Joined: Tue Oct 02, 2018 5:29 am
Re: Save into two database name
wow ok thanks
here is my php code, it might useful if someone want to save into two database in one form
here is my php code, it might useful if someone want to save into two database in one form
Code: Select all
$y = "update `tabel_b` inner join tabel_a ON tabel_a.tabelnameid = tabel_b.tabelnameid
set tabel_a.tabelname = tabel_b.tabelname";
$u = nuRunQuery($y);
-
- Posts: 19
- Joined: Tue Oct 02, 2018 5:29 am
Re: Save into two database name
ok now im facing new problem...
when i save using the query, the table_a is saving from table_b, but when i try to add another items with the same name, it won't save to the table_a, it keep saving from the first data on table_b, the second or third and more is not updating the table_a
here is the code :
The question is, what code should i put to get items.item_stock = item_stock.total?
so that every time i save the form, it will update the items.item_stock.
Please help, im very new with this.
when i save using the query, the table_a is saving from table_b, but when i try to add another items with the same name, it won't save to the table_a, it keep saving from the first data on table_b, the second or third and more is not updating the table_a
here is the code :
Code: Select all
$y = "update `items` inner join item_stock ON item_stock.items = items.items_id
set items.item_stock = item_stock.total";
$u = nuRunQuery($y);
so that every time i save the form, it will update the items.item_stock.
Please help, im very new with this.
Re: Save into two database name
yusa82,
I would just update the 1 record that needs updating.
Steven
I would just update the 1 record that needs updating.
Code: Select all
nuRunQuery("UPDATE items SET item_stock = '#total#' WHERE items = '#RECORD_ID#' ");
Steven
-
- Posts: 19
- Joined: Tue Oct 02, 2018 5:29 am