Closed Thread Icon

Topic awaiting preservation: case insensitive db query Pages that link to <a href="https://ozoneasylum.com/backlink?for=13056" title="Pages that link to Topic awaiting preservation: case insensitive db query" rel="nofollow" >Topic awaiting preservation: case insensitive db query\

 
Author Thread
mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 02-14-2004 00:56

PHP & Oracle 9i

I'd like to check for a login and password from Oracle db. The login needs to be case insensitive.

If I ask for:
$sql = "select * from table where login='$login' and password='$password'";
and $login is not the exact case of login, it will return zero rows.

I know how to use PHP to check if one string matches another in a case insensitive fashion.

How can I make Oracle respond to my query the way I want it to?

Thank you

Kriek
Maniac (V) Inmate

From: Florida
Insane since: Jul 2001

posted posted 02-14-2004 01:05

You can convert both strings to upper/lowercase and then do the comparison.

code:
$sql = "SELECT * FROM table WHERE lower(login)='$login' AND lower(password)='$password'";



__________________

Jon Kriek
www.phpfreaks.com

[This message has been edited by Kriek (edited 02-14-2004).]

mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 02-14-2004 01:16

Convert which strings?
Everyone of the over 10000 users in the db?
Me thinks there's a better method.


[edit...after kriek's edit]
Ah! Yes! Brilliant.

thanks.


[This message has been edited by mobrul (edited 02-14-2004).]

Kriek
Maniac (V) Inmate

From: Florida
Insane since: Jul 2001

posted posted 02-14-2004 01:24

No problem, glad I could be of assistance to you.

__________________

Jon Kriek
www.phpfreaks.com

« BackwardsOnwards »

Show Forum Drop Down Menu