NUM error
3 posts by 3 authors in: Forums > CMS Builder
Last Post: August 12, 2010 (RSS)
By s2smedia - August 12, 2010
I am an idiot.. I accidentally renamed the field_name for "num" in the user accounts viewer.
now Im getting an error and it wont me change it back..
and quick fixes are appreciated..
get this errow when I try to change it back to "num"
Notice: Undefined index: num in /home/apexsocc/club_ambassador/pages/login/lib/admin_functions.php on line 506
There was an error creating the MySQL Column, the error was:
Incorrect table definition; there can be only one auto column and it must be defined as a key
now Im getting an error and it wont me change it back..
and quick fixes are appreciated..
get this errow when I try to change it back to "num"
Notice: Undefined index: num in /home/apexsocc/club_ambassador/pages/login/lib/admin_functions.php on line 506
There was an error creating the MySQL Column, the error was:
Incorrect table definition; there can be only one auto column and it must be defined as a key
Re: [s2smedia] NUM error
By Jason - August 12, 2010
Hi,
The best solution would be to restore a backup from before you made the change. This will rename the field back to "num". It will still have the new column name when you view the section editor, so go to data/schema/ folder and find the accounts.ini.php. The file will look something like this:
Where NEW FIELD NAME is the name you changed num to. Change this back to num and save the file.
That should take care of the issue. It would also be a good idea to disable system field editing from the advanced options menu of your section editor. This will help avoid this mistake in the future.
Hope this helps.
The best solution would be to restore a backup from before you made the change. This will rename the field back to "num". It will still have the new column name when you view the section editor, so go to data/schema/ folder and find the accounts.ini.php. The file will look something like this:
;<?php die('This is not a program file.'); exit; ?>
_disableView = 1
listPageFields = "fullname, username, email, isAdmin"
listPageOrder = "fullname, username"
listPageSearchFields = "fullname, username, email"
menuHidden = 0
menuName = "User Accounts"
menuOrder = 1191281761
menuType = "multi"
tableHidden = 0
[NEW FIELD NAME]
order = 1
isSystemField = 1
[createdDate]
order = 2
type = "none"
label = "Created"
isSystemField = 1
Where NEW FIELD NAME is the name you changed num to. Change this back to num and save the file.
That should take care of the issue. It would also be a good idea to disable system field editing from the advanced options menu of your section editor. This will help avoid this mistake in the future.
Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] NUM error
By Chris - August 12, 2010
Oh wow, we really shouldn't allow people to do that!
I tried this out to see if I could recover from it and it's not looking pretty. Rather than renaming the num field, it was dropped entirely. If you don't have a backup, your CreatedByUserNum and UpdatedByUserNum fields in your other tables are likely going to be corrupt.
I modified my accounts.ini.php as Jason recommended above, but I also had to run an SQL query to add my num field back, since I was trying to recover without using a backup:
This resulted in all my user accounts being assigned fresh nums. Depending on how you've set up your CMS Builder tables, (specifically, whether you're relying on account nums for anything,) this could either be devastating or of no concern at all!
I tried this out to see if I could recover from it and it's not looking pretty. Rather than renaming the num field, it was dropped entirely. If you don't have a backup, your CreatedByUserNum and UpdatedByUserNum fields in your other tables are likely going to be corrupt.
I modified my accounts.ini.php as Jason recommended above, but I also had to run an SQL query to add my num field back, since I was trying to recover without using a backup:
ALTER TABLE cms_accounts ADD COLUMN `num` int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT;
This resulted in all my user accounts being assigned fresh nums. Depending on how you've set up your CMS Builder tables, (specifically, whether you're relying on account nums for anything,) this could either be devastating or of no concern at all!
All the best,
Chris
Chris