getting a Query Error:Unknown column....

Discussion in 'PHP' started by nQQb, Apr 18, 2010.

  1. #1
    Hi all,

    I hope you can help me with this error:
    Query Error:Unknown column 'x' in 'where clause'

    this happens when i click on search function on site, the code using this is:
    	$node->where .= " and (`ExpireDate` > NOW())";
    		}		
    		
    		if($post['q_text'] != ""){
    			if($post['search_both'] != ""){
    				$node->select .= ", MATCH(`Title`, `Description`) AGAINST ('".addslashes($post['q_text'])."' IN BOOLEAN MODE) AS `SScore`";
    				$node->where .= " and MATCH(`Title`,`Description`)  AGAINST ('".addslashes($post['q_text'])."' IN BOOLEAN MODE) ";
    				$post['sortCol'] = "SScore";
    				$post['sortBy'] = "DESC";
    			}
    			else{
    				$node->where .= " and MATCH(Title)  AGAINST ('".addslashes($post['q_text'])."') ";
    			}			
    		}
    			
    		return "(".$mysql->selectSql($node).")";
    	}
    	
    PHP:

     
    nQQb, Apr 18, 2010 IP
  2. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #2
    What is the FULL SQL statement?
     
    lukeg32, Apr 19, 2010 IP
  3. Mohammed Cherkaoui

    Mohammed Cherkaoui Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    that mean the column 'x' is not exists in the table but you did not use a column called 'x' ,
    put the file !
     
    Mohammed Cherkaoui, Apr 19, 2010 IP
  4. ThomasTwen

    ThomasTwen Peon

    Messages:
    113
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What the error basically says is that your script is trying to access an SQL column named 'x' - but it does not exist in the database. We can't fix the error from what you've posted here - you might want to tell us more about your code, or if you are using some well-known software.
     
    ThomasTwen, Apr 19, 2010 IP