Jump to content

Slimming down results with SQL query


r00ttap

Recommended Posts

Honestly this is more of a SQL question then PHP but I'm sure most people here have a good amount of knowledge on both. My problem is that I'm trying to make my code as efficient as possible by pulling only what I need from the database. I will try and draw this out so it will make some sense to you.

 

My current database would be:

+--------------+--------------+
|  end_time    |     date
+--------------+--------------+
|  15:30:00    | 2009-02-02 
+--------------+--------------+

 

I need something posted UNTIL the end_time is up on that specific date. My query looks somethign like this:

	$campus_name = mysql_query("SELECT * FROM table WHERE campus = 'campus_name' AND date >= CURDATE() ORDER by date, time") or die(mysql_error());

 

Of course this will keep something posted until the date changes but I really need the text to disappear after the time is over. Is this something the SQL can't handle and that I may just have to narrow it down even more with PHP?

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/146149-slimming-down-results-with-sql-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.