Hi frnds....

For searching....
when i comparing my input string with database string, i phase problem with case sensitive and white spaces....
plz give me a suggetion to do this....

ex:

input = "bluefox";

but in my database that word is like "Blue Fox"..........

i need to get results without changing database strings....

Try the following to match the 2:

$input='bluefox';
$database_input='Blue Fox';

if (str_replace(' ','',strtolower($input))==str_replace(' ','',strtolower($database_input)))
    {
    echo "They match";
    }
Member Avatar for diafol
$dbText = strtolower(str_replace(" ", "", $dbstring));
$inputText = strtolower(str_replace(" ", "", $inputstring));

if($inputText == $dbText) .....

EDIT: sorry cwarn23, you posted while I was writing!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.