how to make LIKE %word% not case sensitive

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

Code: Select all

  `user_interest` blob NOT NULL, 
  `user_fav_anime` blob NOT NULL, 
  `user_fav_videogames` blob NOT NULL, 
  `user_about` blob NOT NULL,
Here user_interest, user_about doesn't need BLOB datatype as the name says. But Why You are Using BLOB in user_fav_anime. arn't You keeping Any Location of animations in it ?? if Yes then Use Simple text Fields
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

http://dev.mysql.com/doc/refman/5.1/en/blob.html wrote:BLOB columns are treated as binary strings (byte strings) [...]
BLOB columns have no character set, and sorting and comparison are based on the numeric values of the bytes in column values.
Therefore comparison is always case-sensitive for blobs.
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Post by psychotomus »

Mordred wrote:

Code: Select all

$search_phrase = htmlspecialchars(str_replace("\'", "'", $_GET['search']));
This is NOT an adequate protection against ANYTHING. Use mysql_real_escape_string() before putting things in a db query and htmlentities with PROPER parameters before outputting to HTML. As it is, your script is vulnerable to multiple SQL injections, check your PM.
what you mean by htmlentities? never heard of that function before.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

That's why there is an online manual ;)
http://de2.php.net/htmlentities
Post Reply