Hello friends.
I'm trying to do a new simple form that reads and saves data on a table in a database but I've issues. I added in "on Load" a DB read event and certainly, the form reads the first row of the DB table. Also I added in "on Submit" a DB save event, the data are saved correctly, but are saved in the last id (id is auto increment key). Well, this is I want:
- One table with a unique row. Read the first row, load the data in the form and save the modified data on the first row in table DB too.
Thanks for your help.
I'm trying to do a new simple form that reads and saves data on a table in a database but I've issues. I added in "on Load" a DB read event and certainly, the form reads the first row of the DB table. Also I added in "on Submit" a DB save event, the data are saved correctly, but are saved in the last id (id is auto increment key). Well, this is I want:
- One table with a unique row. Read the first row, load the data in the form and save the modified data on the first row in table DB too.
Thanks for your help.
Hi Bob.
I followed your suggestion and this is the debbuger info:
The primary key is "af_id", it's loaded to an input and it's not saved to the table in the DB. As you see "user_id" is saved in last position, not "af_id". In the DB Load event the Fields and Order are: af_id,a40,a42,a45,a5,a58,a6,amenor4,amayor6. The table DB fields are: af_id, uniq_id, user_id, a40, a42, a5, a58, a6, amenor4, amayor6.
I followed your suggestion and this is the debbuger info:
Data Array
Array
(
[option] => com_chronoforms5
[chronoform] => Anillas_federadas_gestion
[event] => submit
[af_id] => 1
[a40] => 0
[a42] => 0
[a45] => 0
[a5] => 0
[a58] => 0
[a6] => 0
[amenor4] => 0
[amayor6] => 0
[button10] => Guardar
[id] => 2
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[5] => Array
(
[DB Save] => Array
(
[Queries] => Array
(
[0] => INSERT INTO `kue3d_chronoengine_chronoforms_datatable_Anillas_federadas` (`a40`, `a42`, `a45`, `a5`, `a58`, `a6`, `amenor4`, `amayor6`, `user_id`) values ('0', '0', '0', '0', '0', '0', '0', '0', '0');
)
)
)
)
The primary key is "af_id", it's loaded to an input and it's not saved to the table in the DB. As you see "user_id" is saved in last position, not "af_id". In the DB Load event the Fields and Order are: af_id,a40,a42,a45,a5,a58,a6,amenor4,amayor6. The table DB fields are: af_id, uniq_id, user_id, a40, a42, a5, a58, a6, amenor4, amayor6.
Well, now it works.
I changed the name "af_id" to "id" for the input and for the field in the DB table.
I changed the name "af_id" to "id" for the input and for the field in the DB table.
Array
(
[option] => com_chronoforms5
[chronoform] => Anillas_federadas_gestion
[event] => submit
[id] => 1
[a40] => 99
[a42] => 0
[a45] => 0
[a5] => 0
[a58] => 0
[a6] => 0
[amenor4] => 0
[amayor6] => 0
[button10] => Guardar
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[5] => Array
(
[DB Save] => Array
(
[Queries] => Array
(
[0] => UPDATE `kue3d_chronoengine_chronoforms_datatable_Anillas_federadas` AS `Data` SET `a40` = '99', `a42` = '0', `a45` = '0', `a5` = '0', `a58` = '0', `a6` = '0', `amenor4` = '0', `amayor6` = '0', `user_id` = '0' WHERE `id` = '1';
)
)
)
)
This topic is locked and no more replies can be posted.