Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 11-30-2009, 03:26 PM select by date
Average Talker

Posts: 26
Trades: 0
Hi there I have a table which holds news that users add as they wish, each news add is added along with the date using

$tm= date("Y-m-d H:i:s");

I want to display the news back. This i can do, however is there any way at all that I can make the select statement only select news from todays date only:

so

select * from news where date = "todays date";

obviously I dont think "todays date" would do it, I have put it there as an example.

Any help greatly appreciated thanks
applebiz89 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-30-2009, 03:41 PM Re: select by date
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
date is a reserved word so should not be used as a column name.

... date = curdate();
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-30-2009, 06:35 PM Re: select by date
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
As Chris said, but only if your "date" field is a date related datatype.
If you store the date in a varchar field, then you will need to convert it to datetime before.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to select by date
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11327 seconds with 12 queries