pc-buddy
asked on
Php Sql Query
Hi,
I'm trying to pull all records for a certain Id from the Db, this is my query
But no results are returned.
What is wrong please
Thank Simon
I'm trying to pull all records for a certain Id from the Db, this is my query
SELECT * FROM child_session WHERE child_id=293 And end_date > 2016-10-13 And start_date < 2016-10-13
But no results are returned.
What is wrong please
Thank Simon
Try quoting your dates - otherwise what does your data look like?
ASKER
start_date is 2016-09-02
end_date is 2016-12-15
Thanks
end_date is 2016-12-15
Thanks
That's not a data record - can you post a script with the table definition and data.
ASKER
Hi,
Sorry, picture attached of DB,
I need to pull only session that are active and I've noticed the end dates of some are 0000-00-00
Thanks Simon
query.jpg
Sorry, picture attached of DB,
I need to pull only session that are active and I've noticed the end dates of some are 0000-00-00
$sessionsq = "SELECT * FROM child_session WHERE child_id='".$id."' And end_date > '".$today."' And start_date < '".$today."'";
$childsessions = mysql_query( $sessionsq, $conn );[embed=file 1122094]
Thanks Simon
query.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for all your help
You are welcome.