This is mysql statement
$query="SELECT * FROM `error_report` AS e
INNER JOIN `pages` AS p ON e.page_id=p.page_id
WHERE `task_id` ='".$this->task_id."' AND
((google_host_fail=1
OR robots_noindex_nofollow=1
OR xrobots_noindex_nofollow=1
OR google_cache_fail=1
OR forbidden_word=1)
OR (google_title_fail=1 AND h1_fail=1 AND h2_fail=1 AND h3_fail=1))";
I want here, to return results on condition that there is task id.. and or any of the two satements enclosed in brackets The problem is in the last where statement, I want a condition that if all those fields.
I have got another sql problem with a similar statement.
public function check_success()
{
$query="SELECT e.* FROM `error_report` AS e
INNER JOIN `pages` AS p ON e.page_id=p.page_id
WHERE `task_id` ='".$this->task_id."'
AND ((google_title_fail=0) OR (google_title_fail=1 AND h1_fail=0))";
$result=$this->db->query($query)->result_array();
if(count($result)>0)
{
return 1;
}
return 0;
}
I want to achieve the same above.. But I dont see that my statements work
How can I enclose the where statements with brackets so that they will work in both functions..
public function findFinalResult()
{
if($this->check_fail())
{
return "Failure";
}
else if($this->check_success())
{
return "Success";
}
return "Warning";
}
Final results gives fail each time..? why ?!?