- 2,492
Hi all,
I'm working on pulling data from a mySQL database through a php page for an internship that I have. However, I seem to have a problem in that some data will not be returned in my resultset for an unknown reason. The php for the sql query I am trying to execute is as follows:
However, when I attempt to execute it inside the php page i am constructing, the following line in the IN statement of the WHERE clause does not seem to return results even though when I run the exact same query inside the database it does return results for the statement below.
I am completely stumped on this one as I am pretty sure that the SQL syntax is grammatically correct. Everything else in the IN statement of the WHERE clause seems to return otherwise.
Thanks in advance to anyone who can help me solve this...
I'm working on pulling data from a mySQL database through a php page for an internship that I have. However, I seem to have a problem in that some data will not be returned in my resultset for an unknown reason. The php for the sql query I am trying to execute is as follows:
PHP:
$sql_kcnc = mysql_query("SELECT count(*) as count,
CASE url
WHEN 'http://kindervision.org/kcnc_the_greatest_save/' THEN '<b class=\"red\">KCNC TGS Page</b>'
WHEN 'http://kindervision.org/kindiclub/retrieve.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Kindclub Quiz Page</b>'
WHEN 'http://kindervision.org/kindiclub/score.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Kindclub Score Page</b>'
WHEN 'http://kindervision.org/wt/wt_retrieve.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Wolftraps Quiz Page</b>'
WHEN 'http://kindervision.org/wt/wt_score.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Wolftraps Score Page</b>'
WHEN 'http://kindervision.org/parents/retrieve.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Parents Quiz Page</b>'
WHEN 'http://kindervision.org/parents/score.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Parents Score Page</b>'
WHEN 'http://kindervision.org/safety_info.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Safety Tip of the Day Page</b>'
WHEN 'http://kindervision.org/wolftraps/index.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Wolftraps Page</b>'
WHEN 'http://kindervision.org/products.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Products Page</b>'
WHEN 'http://kindervision.org/events.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Events Page</b>'
WHEN 'http://kindervision.org/event/index.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Events Video Page</b>'
WHEN 'http://kindervision.org/predatorsafety/asktheexperts.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Predator Safety Page</b>'
WHEN 'http://kindervision.org/kvvideo/retrieve.php?state=CO&city=Denver&chapter=1' THEN '<b class=\"red\">KCNC KVVideo Page</b>'
ELSE url
END AS url
FROM statTracker
WHERE
url IN('http://kindervision.org/kcnc_the_greatest_save/',
'http://kindervision.org/kindiclub/retrieve.php?state=CO&city=Denver',
'http://kindervision.org/kindiclub/score.php?state=CO&city=Denver',
'http://kindervision.org/wt/wt_retrieve.php?state=CO&city=Denver',
'http://kindervision.org/wt/wt_score.php?state=CO&city=Denver',
'http://kindervision.org/parents/retrieve.php?state=CO&city=Denver',
'http://kindervision.org/parents/score.php?state=CO&city=Denver',
'http://kindervision.org/safety_info.php?state=CO&city=Denver',
'http://kindervision.org/wolftraps/index.php?state=CO&city=Denver',
'http://kindervision.org/products.php?state=CO&city=Denver',
'http://kindervision.org/events.php?state=CO&city=Denver',
'http://kindervision.org/event/index.php?state=CO&city=Denver',
'http://kindervision.org/predatorsafety/asktheexperts.php?state=CO&city=Denver',
'http://kindervision.org/kvvideo/retrieve.php?state=CO&city=Denver&chapter=1'
)
AND thedate_visited = '$begin_date'
GROUP BY url
ORDER BY count DESC")
or die(mysql_error());
PHP:
'http://kindervision.org/kcnc_the_greatest_save/',
Thanks in advance to anyone who can help me solve this...