This question already has an answer here:
I have the following code but my mysql query is not returning me any value. Please tell me what am I doing wrong:
foreach($stagearray as $catgry){
echo $catgry;//this is returning the values
$sql = mysql_query("
select
count(reference) as CCOUNTS,
assignee_group
from
issue_tracking_issues i,
issue_tracking_issues_issue_tracking_projects j
where
status NOT LIKE 'Closed%'
AND i.id=j.issue_tracking_issue_id
AND j.issue_tracking_project_id=1
and $value
having
SUBSTR(date_raised,3,3)
group by
assignee_group
");
while($rows = mysql_fetch_array($sql)){
This is giving me the following warning:
PHP Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
I am guessing that my sql query is not able to resolve $catgry but I don't know why
</div>