Jump to content

Recommended Posts

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);
	}
}

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.