Membership Saved Searches MySQL Error: Data too long for column

By Mikey - November 4, 2011 - edited: November 4, 2011

Today while testing an install for Membership Saved Searches I decided to see what would happen if someone entered a very long name for a saved search and when I did I got the following message.

Error: MySQL Error: Data too long for column 'name' at row 1
(at websiteSavedSearches.php line 128)

Prevent this page from creating additional dialogs


The long test message was:

This very long message is to test how long a saved search name can be. This very long message is to test how long a saved search name can be. This very long message is to test how long a saved search name can be. This very long message is to test how long a saved search name can be. This very long message is to test how long a saved search name can be.

I tried editing the Website Saved Searches section editor record "Search Name" to limit the amount of characters using "Max Length", but that didn't seem to resolve the issue.

I know this is ridiculously long for a saved search name and it's highly unlikely anyone would ever save a search with such a name. But is it possible to set a limit on the amount of characters that can be entered into the name filed for saved searches?

Anyone have any suggestions?
If I check the (Prevent this page from creating additional dialogs) box will this resolve the issue for anyone who is logged into the site? OR only resolve the issue for me?

Thanks Zick

Re: [zick] Membership Saved Searches MySQL Error: Data too long for column

By Jason - November 7, 2011 - edited: November 7, 2011

Hi,

Sorry for the blank post.

What is happening here is that the text being entered is too long for the name field in the database. The "max length" value is only used for error checking when creating a record inside the cms.

The _website_saved_searches table that the plugin creates is of type varchar(255) (ie, can accept a maximum of 255 characters). Any reasonable length saved search name would be under that length. However, if you want to be able to increase this length, try this:

-edit your saved searches section and click modify for "name".
-under Advanced Options, in the MySql Column Type, type in MEDIUMTEXT NOT NULL

Remember to backup your database and files prior to attempting this.

This will increase the size of the name field to take in the length of name you are referring to.

The "Prevent this page from creating additional dialogs" is a javascript feature of your browser. It is meant to stop the same error from showing up multiple times. The error is still occurring, it just wouldn't be reported.

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/