Hi Kyle,
we have a strange problem, when trying to insert a string into our sql data base with results obtained via auto actions. More specifically,
in Joomla in the Auto Action section we defined a new auto action (activity_onAfterCreateComment) with php-code in the action tab that looks like this
Code:
//Prepare db
$db = JFactory::getDbo();
//Get asset via comment id
$comment_id = [var1_id];
$db->setQuery("SELECT `asset` FROM `#__comprofiler_plugin_activity_comments` WHERE `id` = ".$comment_id );
$db->execute();
$asset = $db->loadResult();
//Insert asset id
$db->setQuery("INSERT INTO `#__testing` (`a`, `b`) VALUES (".$asset.",".$asset .")");
$db->execute();
We are just querying the asset id from the post a user has commented on, which we would like to store into a database.
However, the insert does not work, in the sense that it only saves integers, although the database is configured to save text. Varchar as the database type did not work either.
Another question would be, how to actually get the asset id via the triggering of the auto action, because [var1_asset] or [asset] did not work.
Finally, is there any way to debug auto action code, i.e. show/print the contents of the variables defined in the action tab.
Thanks, Tim