PowWeb Forums - The Perfect Community for the Perfect Host  

Register now to interact with over 11,000 members! Registered users have Posting Privileges, free access to Private Messaging, Email Notifications and more.

Go Back   PowWeb Community Forums > The PowWeb Platform > MySQL
User Name
Register FAQ Members List Search Today's Posts Mark Forums Read

Thread Tools
Old 3-27-12, 03:55 PM   #1
Join Date: Feb 2008
Location: Colombia
Posts: 127
Reputation: 32
search for string in a text column

hi, i want to make a search related with search tags, and those tags are all stored in the same column, as a text separated by commas. all tags are saved urlencoded, which means all weird chars are stored as %xx, where xx is a number. the only way i know to search for a substring in mysql so far is with 'like'; so i believe if i am gonna search for a series of tags, i have to include in my search something like 'or tags like tag1 or tags like tag 2' etc.

two questions:

1. is there any other way, besides 'like', to search for a pattern or substring in a string?
2. there is a problem with what i am doing so far, and i was not aware of that before: i save all tags as urlencoded because of security reasons, but the urlencoded uses '%' to save all weird chars.. but the % sign is also used as a apttern match in the like statement, so if i search for something like urlencoded(''), which i have no idea how would it be but would output something like %xx, how do i search for the exact string '%xx' that represents the in the database?



i just found out i can escape the % with a \, but anyway, is there any other way to search for a substring in mysql, so i do not have to use expressions? (which would be way slower than search for an exact string, in many rows)
VooDooChicken is offline   Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT -4. The time now is 01:47 PM.

Contents ©PowWeb, Inc. ~ vBulletin, Copyright 2000-2007 Jelsoft Enterprises Limited.