When a user submits a form I want, in addition to saving the contents to a database table (which it does), I also want to update a value in another table. Is this best done with a Custom Code or a DB Save?
I have tried both but cannot seem to get it right.
The sql for what I want to do is:
UPDATE `y2vfp_comprofiler` SET `cb_usertype` = 'w' WHERE `y2vfp_comprofiler`.`id` = (the user id);
I have tried variations on the following, both as custom code and as DB save, but always get an error.
Parse error: syntax error, unexpected '`' in /home/wwoofjap/www/www/home/administrator/components/com_chronoforms5/chronoforms/actions/db_save/db_save.php(86) : eval()'d code on line 4
(it changes somewhat depending on what I have tried modifying in the php code)
Can someone advise me as to proper syntax and whether this is best suited to custom code or db save?
I have tried both but cannot seem to get it right.
The sql for what I want to do is:
UPDATE `y2vfp_comprofiler` SET `cb_usertype` = 'w' WHERE `y2vfp_comprofiler`.`id` = (the user id);
I have tried variations on the following, both as custom code and as DB save, but always get an error.
<?php
// get current user
$user = JFactory::getUser();
UPDATE `y2vfp_comprofiler` SET cb_usertype = w WHERE `y2vfp_comprofiler.id` = $user;
?>
The error I get is always something along the lines of:
Parse error: syntax error, unexpected '`' in /home/wwoofjap/www/www/home/administrator/components/com_chronoforms5/chronoforms/actions/db_save/db_save.php(86) : eval()'d code on line 4
(it changes somewhat depending on what I have tried modifying in the php code)
Can someone advise me as to proper syntax and whether this is best suited to custom code or db save?