Hi Bob,
I have a DB save to a table with 'id' as the primary key.
Right after it I have a custom code that tries to capture the value of that primary key following this guide: https://www.chronoengine.com/faqs/63-cfv4/cfv4-working-with-form-data/2596-how-can-i-give-a-unique-id-to-each-form-submission.html
The value of the $new_id is found to be always 0!
Please kindly advise what's wrong with my code?
Thanks,
kwok
I have a DB save to a table with 'id' as the primary key.
Right after it I have a custom code that tries to capture the value of that primary key following this guide: https://www.chronoengine.com/faqs/63-cfv4/cfv4-working-with-form-data/2596-how-can-i-give-a-unique-id-to-each-form-submission.html
<?php
$new_id = $form->data['chronoform_data']['cf_id'];
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query = "INSERT INTO.... new_table(id,......) Values('$new_id',....)";
$db->setQuery($query);
$db->execute();
?>
The value of the $new_id is found to be always 0!
Please kindly advise what's wrong with my code?
Thanks,
kwok
Hi Kwok,
I suggest that you add a Debugger action temporarily after the DB Save - that will show you where the id value is. My guess is that it isn't called cf_id in the table you are updating.
Bob
I suggest that you add a Debugger action temporarily after the DB Save - that will show you where the id value is. My guess is that it isn't called cf_id in the table you are updating.
Bob
Hi Bob,
I placed the debugger before the DB Save.
Per your advice, I placed the debugger after the DB Save. It shows that the field that contain the value is
$form->data['id']
You are genius!
I always thought that the debugger is able to show all information after its line.
Really appreciate your guidance!
Thanks,
kwok
I placed the debugger before the DB Save.
Per your advice, I placed the debugger after the DB Save. It shows that the field that contain the value is
$form->data['id']
You are genius!
I always thought that the debugger is able to show all information after its line.
Really appreciate your guidance!
Thanks,
kwok
This topic is locked and no more replies can be posted.