php - PDO (bindValue) not liking my wildcards -
i have simple piece of text form want pass placeholder , works on other pieces of text. whatever reason when search word "fun", script fails.
here code. normally, straight forward, can't seem wrap head around one. thoughts appreciated.
$search = $_post['searchinput']; $search = strtolower($search); $search = '%'.$search.'%'; seek { $sqlsearch = "select items.item_id,item_detail,auc_id,item_desc,categories,min_bid_increment,auc_start,auc_end,display_item,bidder,amount_bid items left bring together bid_history on items.item_id = bid_history.item_id org_id = :orgid , auc_id not 'live%' , display_item = '1' , item_detail :searchinput or item_desc :searchinput or items.item_id :searchinput order items.item_id asc, bid_history.amount_bid desc;"; $ssearch = $pdo->prepare($sqlsearch); $ssearch->bindvalue(':orgid',$org_id); $ssearch->bindvalue(':searchinput',$search); $ssearch->execute(); $resultssearch = $ssearch->fetchall(); } grab (pdoexception $e) { echo $e; }
edit:
if manually set query database, results back.
select items.item_id,item_detail,auc_id,item_desc,categories,min_bid_increment,auc_start,auc_end,display_item,bidder,amount_bid items left bring together bid_history on items.item_id = bid_history.item_id org_id = 'chs102915' , auc_id not 'live%' , display_item = '1' , item_detail '%fun%' or item_desc '%fun%' or items.item_id '%fun%' order items.item_id asc, bid_history.amount_bid desc
the problem end beingness query using grabbing many records ended giving me memory error crash script. how corrected was, have more efficient query. set error indicators fred explained above in comments , semicolon issue @ end n.b. in end had nil wildcards or placeholder, query needed improvement.
php pdo
No comments:
Post a Comment