![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Aug 2005
Location: Leeds - UK
Posts: 69
Rep Power: 4
![]() |
Querying database - help
Hi there people...
I have the following table in my database activity (activityID, userID, time, page) It keeps track of which page the users have visited and when, a bit like big brother i guess. I have just finished a view activity script, where the user enters the name of a user and the script outputs the activity of the user specified. However, if the user has been busy, this can be many (100's) of rows of data. I need to allow the user to search a specified date range, i.e. 15 January 2005 - 15 January 2006. How can i do this??? The date is stored as; Friday 24th of February 2006 05:24:39 PM Any suggestion??? Regards pps |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Make sure that your date-time is stored in the DB in a manner that the DB construes as a date-time, then just build a query according to their rules.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Feb 2006
Posts: 40
Rep Power: 0
![]() |
I have just done that kind of script searching a database by means of day and many more.U must format ur text according to the information in the database or vice-versa.
No matter which programming language u use,there must be a date function which is getting date according to a given format.U can also find their formatting usage... |
|
|
|
|
|
#4 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
|
|
|
|
|
|
|
#5 | |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Quote:
2006-02-24 17:24:39 SELECT `time` FROM `activity` WHERE `time` >= '2005-01-15' AND `time` <= '2006-01-15' ORDER BY `time` ASC |
|
|
|
|
|
|
#6 |
|
Programmer
Join Date: Aug 2005
Location: Leeds - UK
Posts: 69
Rep Power: 4
![]() |
I'v managed to fix it.
My stupid self had stored the date as a string - changed it to time stamp and some time later - its working fine now! thanks!! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|