I have a MySql database that uses a time field to track when the entry was inserted.

Now I want to query the table for entries by a time range.
I would prefer to use MySql to extract the records instead of extracting all records then iterating and comparing time in php.

success on these two kinds of queries:

// this doesn't appear to be working
SELECT * FROM table_name 
WHERE DATE(TIME_ROW_START) BETWEEN '".$timestart."' AND DATE(TIME_ROW_END) BETWEEN '".$timeend."';

// this doesn't appear to be working either
SELECT * FROM table_name 
WHERE DATE(TIME_ROW_START) >= '".$timestart."'
AND DATE(TIME_ROW_END) <= '".$timeend."';

Is there a way to do this?

This is related to http://www.daniweb.com/web-development/php/threads/410631/1752245

You failed to reply to that thread and started this one. Any reason?

Im so sorry sir for not replying.

actually sir im just trying this one and if its work
the reason that ididt reply is because i created this one for temporary purpose only if i use sql query to trap range time using time format in mysql.

if its ok with you sir

and im very sorry for not replying you. hope you understand

Member Avatar

diafol

Maybe you should stick to the same thread. Progression of an idea is a worthy *addition* to an existing thread that you started. Creating new threads and ignoring threads in progress just risks alienating contributors that offered to help you.

Maybe you should stick to the same thread. Progression of an idea is a worthy *addition* to an existing thread that you started. Creating new threads and ignoring threads in progress just risks alienating contributors that offered to help you.

ok sir and im so sorry

im going to back to the first thread i post

Member Avatar

diafol

OK, perhaps mark this as solved - just to prevent others from posting here, and carry on with the old one. :)