note 24220 deleted from function.strtolower by nlopess
| From: | nlopess@php.net | Date: | Fri, 18 Nov 2005 19:26:42 +0000 |
| Subject: | note 24220 deleted from function.strtolower by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-98774@lists.php.net to get a copy of this message | ||
Note Submitter: zaid at designerz dot com
----
//compare user input with database. Insert the call to the function inside your sql statement
//by zaid@designerz.com
function compare($field_name, $string)
{
$string_lower = strtolower($string); //makes $string all lower case
$string_upper = strtoupper($string); //makes $string all upper case
$string_ucfirst = ucfirst($string_lower); //capitalizes first letter
$string_ucwords = ucwords($string_lower); //converts a whole phrase to first upper
return " ($field_name Like '" . $string . "%' Or $field_name Like
'" . $string_upper . "%' Or $field_name Like '" . $string_ucfirst .
"%' Or $field_name Like '" . $string_ucwords . "%') " ;
}