noncent / pdo_class_wrapper

A Class for PDO Wrapper
25 stars 21 forks source link

wild cards? #1

Closed caleb87 closed 10 years ago

caleb87 commented 10 years ago

When passing a wildcard to select, it produces an error. For example:

$q = $db->select('Wells', '', array('Name LIKE '=>'%anderson%'))->results();

With PDO, execute(array(':Name'=> '%anderson%')) will return a wild card match. I went through the class quickly to find why this was happening, but didn't spot it.

noncent commented 10 years ago

Hi caleb87,

You should use like

$q = $db->select('Wells', '', array('Name LIKE'=>'%anderson%'))->results();

instead of

$q = $db->select('Wells', '', array('Name LIKE '=>'%anderson%'))->results();

You are appending a space after LIKE; So, remove space and get your luck :dart: