We're creating a form that will dump data into a db table, but we're needing to empty the table upon submission and replace with the new submission data. Could I please get a little help on what to enter for that?
CF v4 RC3.0
J! 1.7.X
Thanks!,
Wesley
CF v4 RC3.0
J! 1.7.X
Thanks!,
Wesley
Hi hominid4,
Just checking as this sounds like a weird thing to need to do? Are you sure you need to drop the table contents? If you have two submissions close together you may lose one of them completely??
To do it add a Custom action to the On Submit event, drag it up before the DB Save action and add code like this
This will delete all the records in the table with no warnings and no error checks. Be absolutely sure that you have the correct table name in there before testing!!
Bob
Just checking as this sounds like a weird thing to need to do? Are you sure you need to drop the table contents? If you have two submissions close together you may lose one of them completely??
To do it add a Custom action to the On Submit event, drag it up before the DB Save action and add code like this
$db =& JFactory::getDBO();
$query = "
DELETE FROM `#__table_name` ;
";
$db->setQuery($query);
$db->query();
This will delete all the records in the table with no warnings and no error checks. Be absolutely sure that you have the correct table name in there before testing!!
Bob
Thanks Bob, I'll give that a try.
This will be a hidden form that the client will submit, we're just needing those fields dumped in the table to use. The fields are being called to a section on the site and this form will be used by the client to keep that section updated.
Thanks again,
Wesley
This will be a hidden form that the client will submit, we're just needing those fields dumped in the table to use. The fields are being called to a section on the site and this form will be used by the client to keep that section updated.
Thanks again,
Wesley
This topic is locked and no more replies can be posted.