Page 1 of 1

mysql_query case questions

Posted: Fri Oct 01, 2010 5:48 pm
by ZEKI692

Code: Select all

$result = mysql_query(("SELECT * from test WHERE id = '$wanted' OR name = '$wanted'" )) or die('Failed to connect.');
I'm making a search function and I'm trying to configure it so users can search either 'screw' or Screw' and get the same results, but I'm not sure how to change the case. Any help?

Re: mysql_query case questions

Posted: Fri Oct 01, 2010 6:00 pm
by DigitalMind

Code: Select all

$result = mysql_query("SELECT * from test WHERE upper(name) = upper('$wanted')") or die('Failed to connect.');

Re: mysql_query case questions

Posted: Fri Oct 01, 2010 7:20 pm
by Eran
use a character set that ends in _ci - which stand for case-insensitive