how to copy database records of one table section to another table section?

6 posts by 3 authors in: Forums > CMS Builder
Last Post: October 16, 2014   (RSS)

Hi Everyone

Post 2232571 provides a script to take data from one table editor and copy it into another.  However, when I run the script, I get the following error:

mysql_getMysqlSetValues: Invalid column name 'top_menu:text', contains disallowed chars!

Does anyone have any ideas what I can do from here?

Ragi

--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

By claire - October 14, 2014

Hi Ragi

The issue with that is likely because of the colon in the label text. There is no actual column called 'top_menu:text' in the table itself - that's a generated field.

Personally I just wouldn't transfer the data through PHP. I use MySQL Workbench and straightforward queries to copy and move data around, if only because there's far less of a chance of data corruption.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Claire:  I usually use phpmyadmin but got a bit confused with the CMSB data structure.  Did it change drastically when you moved to CMSB 2.5+ ?

--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

By Dave - October 15, 2014

Hi Guys, 

There's no support for copying a table to another table in CMSB because it's not something you'd normally need to do, but you could do it like this (using a section called "widgets" as an example):

  • Admin > Sections Editors > Add New Editor > Copy Existing Section > widgets > Save as New Table/Menu Name: widgets2
  • Admin > General Settings > Backup & Restore > Backup Table > widgets
  • Rename backup file from: /cmsb/data/backups/[domain]-[date]-widgets.sql.php to [domain]-[date]-widgets2.sql.php
  • Edit [domain]-[date]-widgets2.sql.php and replace "widgets" with "widgets2"
  • Admin > General Settings > Backup & Restore > Restore Table > widgets2

Note that uploads won't copy over properly, but you'll get all the MySQL data.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

Dave/Claire:  This solution worked perfectly!

Thank you.

Ragi

--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke