Page 1 of 1

Searching within a field.

Posted: Mon Nov 25, 2002 8:54 pm
by Gen-ik
I have a MySQL Database with a load of website member names as part of it. This DB is used to check members usernames and passwords when they sign-in.

What I am planning to do is insert <font color=#ff6600> before their username, and </font> after it... within the actual database.

Now, is it possible to search the usernames but ignore the two font tags?

I have to include the font tags in the database because the usernames get pulled from it all over the site, and over several sites.

Re-coding each and every page that displays usernames is not an option.


Is it possible... or should I cry?

Posted: Mon Nov 25, 2002 10:47 pm
by volka
you might add the tag to your search, e.g.

Code: Select all

$query = 'SELECT ... WHERE login='''.mysql_escape_string('&lt;font color=#ff6600&gt;'.$login.'&lt;/font&gt;').'''';
or select with a LIKE statement and check later stripping the tags.
But this is a dirty hack, so if someone asks; I didn't tell you Image