Using Chronoforms V4 (lates version) I tried backing up and restoring a form from one J2.5.19 website to another. The form itself uses a custom script to fetch a value from a table in the database and put that into a new form->data[] key. The PHP script run looks as follows:
<?php
$dealer_id = 0 ;
$db = JFactory::getDBO();
$query = "SELECT MAX(id) FROM jos_locations";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
$row = mysql_fetch_row($result);
$dealer_id = $row[0] + 1 ;
$form->data['dealer_id'] = $dealer_id ;
?>
All necessary values to execute the query should be obtained with the line
$db = JFactory::getDBO();
It should return the values for the new website on which it is run. However, when this script is run in the form on the new website, it returns an error message:
Error in query: SELECT MAX(id) FROM jos_locations. Access denied for user 'user'@'localhost' (using password: NO)
The user@localhost in the error messages includes user details from the website from which the form was backupped (removed here for safety reasons).
My conclusion is that either form or the backup stores website related information that is not replaced when importing the form on a new website. As such, this limits the backup and restore function quite a bit😟 .
Have I overlooked something here, or is this a limitation or a bug ?
Thank you and best regards from
Erik