AND NOT不在php中运行sql查询

时间:2017-11-04 14:29:54

标签: php mysql

我不希望数据中的值=喜剧和价值=英语 但是此查询显示的值是英语

else if(($_POST['genre'] == "Action")&&($_POST['language'] == "Hindi")) {
                $query = "SELECT movies.Title,movies.Description,movies.Movie_length,movies.Movie_release_date,movies.Featured_image 
                    FROM((relationship INNER JOIN category ON relationship.Category_id=category.Id) 
                    INNER JOIN movies ON relationship.Movies_id=movies.Id)   
                    WHERE NOT category.value='Comedy' AND NOT category.value='English'";
                    $search_result = filterTable($query);

1 个答案:

答案 0 :(得分:0)

试试这个:

else if(($_POST['genre'] == "Action")&&($_POST['language'] == "Hindi")) {
            $query = "SELECT movies.Title,movies.Description,movies.Movie_length,movies.Movie_release_date,movies.Featured_image 
                FROM((relationship INNER JOIN category ON relationship.Category_id=category.Id) 
                INNER JOIN movies ON relationship.Movies_id=movies.Id)   
                WHERE category.value NOT LIKE 'Comedy' AND category.value NOT LIKE 'English'";
                $search_result = filterTable($query);

或:

else if(($_POST['genre'] == "Action")&&($_POST['language'] == "Hindi")) {
            $query = "SELECT movies.Title,movies.Description,movies.Movie_length,movies.Movie_release_date,movies.Featured_image 
                FROM((relationship INNER JOIN category ON relationship.Category_id=category.Id) 
                INNER JOIN movies ON relationship.Movies_id=movies.Id)   
                WHERE category.value NOT IN ('Comedy','English')";
                $search_result = filterTable($query);