1

i don't get the appropriate results from LIKE search using PDO because PDO search is case sensitive, i want case insensitive.

I have this query, but it returns only data which fully matches if there is Alphabet a small in database, the i don't get result if i search with capital alphabet A.

$stmt = $conn->prepare("SELECT ROOM, GUEST_NAME, GUEST_FIRST_NAME, CONFIRMATION_NO, DEPARTURE, PWD FROM RESERVATION_GENERAL_2 WHERE GUEST_FIRST_NAME LIKE ? OR GUEST_NAME LIKE ?");
$stmt->execute(array('%'.$searchFilter.'%','%'.$searchFilter.'%' ));

is there anyway to fix this query to make it case insensitive?

im using oracle 11g Xpress Edition database.

Sizzling Code
  • 5,932
  • 18
  • 81
  • 138
  • See http://stackoverflow.com/questions/5391069/case-insensitive-searching-in-oracle – terrywb Sep 09 '14 at 21:35
  • @Mr.Smith PDO is not a DBMS. PDO is an abstraction layer that sits between PHP and a database using one of a number of drivers for various DBMSes such as MySQL, MSSQL, and *Oracle* to name a few. – Sammitch Sep 09 '14 at 22:32

1 Answers1

2

usually something like the following works

…WHERE LOWER(GUEST_FIRST_NAME) LIKE ? OR LOWER(GUEST_NAME LIKE) ?
$stmt->execute(array('%'.strtolower($searchFilter).'%','%'.strtolower($searchFilter).'%' ));
Class
  • 3,149
  • 3
  • 22
  • 31