bradmasterx Posted July 11, 2010 Share Posted July 11, 2010 It dosent get down to the bottom ? i even tried echo'ing the $SQL varible inside the query function but just nothing. No errors are given but the query does not take place. function runSearch (DBConnection $DB ,$keyword=false, $partno=false, $manufacturer=false, $Start=0, $Limit=30){ $SQL = "SELECT * FROM `turbodata`"; if(!empty($keyword)){ $peices = explode(" ", $keyword); $HowManyKeywords = count($peices); if($HowManyKeywords == 1){ $SQL .= " WHERE `make` LIKE '%$keyword%' "; $SQL .= "|| `model` LIKE '%$keyword%' "; $SQL .= "|| `engine` LIKE '%$keyword%' "; $SQL .= "|| `enginecode` LIKE '%$keyword%'"; $SQL .= "|| `year` LIKE '%$keyword%' "; $SQL .= "|| `turbotype` LIKE '%$keyword%' "; $SQL .= "|| `partno` LIKE '%$keyword%' "; $SQL .= "|| `dashnumbers` LIKE '%$keyword%' "; $SQL .= "|| `oem` LIKE '%$keyword%' "; $SQL .= "|| `oem2` LIKE '%$keyword%' "; $SQL .= "|| `oem3` LIKE '%$keyword%' "; $SQL .= "|| `oem4` LIKE '%$keyword%' "; $SQL .= "|| `oem5` LIKE '%$keyword%' "; $SQL .= "|| `oem6` LIKE '%$keyword%'"; }elseif($HowManyWords > 1){ for($a=0;$a<$HowManyKeywords;$a++) { $SQL = " WHERE `make` LIKE '%$pieces[$a]%' "; $SQL .= "|| `model` LIKE '%$pieces[$a]%' "; $SQL .= "|| `engine` LIKE '%$pieces[$a]%' "; $SQL .= "|| `enginecode` LIKE '%$pieces[$a]%'"; $SQL .= "|| `year` LIKE '%$pieces[$a]%' "; $SQL .= "|| `turbotype` LIKE '%$pieces[$a]%' "; $SQL .= "|| `partno` LIKE '%$pieces[$a]%' "; $SQL .= "|| `dashnumbers` LIKE '%$pieces[$a]%' "; $SQL .= "|| `oem` LIKE '%$pieces[$a]%' "; $SQL .= "|| `oem2` LIKE '%$pieces[$a]%' "; $SQL .= "|| `oem3` LIKE '%$pieces[$a]%' "; $SQL .= "|| `oem4` LIKE '%$pieces[$a]%' "; $SQL .= "|| `oem5` LIKE '%$pieces[$a]%' "; $SQL .= "|| `oem6` LIKE '%$pieces[$a]%'"; } } if(!empty($partno)){ if(!strstr($SQL, "WHERE")){ $SQL .= " WHERE `partno` LIKE '$partno%'"; } else{ $SQL .= " && `partno` LIKE '$partno%'"; } } if(!empty($manufacturer)){ if(!strstr($SQL, "WHERE")){ $SQL .= " WHERE `make` LIKE '$manufacturer'"; } else{ $SQL .= " && `make` LIKE '$manufacturer'"; } } $SQL .= " LIMIT {$Start},{$Limit}"; return $DB->query($SQL); } } Quote Link to comment https://forums.phpfreaks.com/topic/207406-why-isnt-it-getting-down-to-the-bottom-of-the-function/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 11, 2010 Share Posted July 11, 2010 A) How are you calling the function? Are you sure you are providing it with data that would cause it to take an execution path that executes the query?, and B) Are you developing and debugging your php code on a system with error_reporting set to E_ALL and display_errors set to ON so that all the errors php detects will be reported and displayed? Quote Link to comment https://forums.phpfreaks.com/topic/207406-why-isnt-it-getting-down-to-the-bottom-of-the-function/#findComment-1084446 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.