SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
Thread: PHP/ Mysql Query ?
-
Jun 15, 2007, 06:37 #1
- Join Date
- Dec 2002
- Location
- Manchester UK
- Posts
- 310
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PHP/ Mysql Query ?
Hi Guys,I am posting a link here under advisement of the PHP Guys,This is basically a MySQL Problem (We think) but it is also a PHP problemhttp://www.sitepoint.com/forums/showthread.php?t=485350Any help would be greatThanksKenny
-
Jun 15, 2007, 07:54 #2
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
i read the other thread and still don't understand your question
perhaps you can try it again in this thread
i do understand your table
however, it's not at all clear what you want as a result from the query
-
Jun 15, 2007, 08:16 #3
- Join Date
- Dec 2002
- Location
- Manchester UK
- Posts
- 310
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
OK here goes......
PHP Code://run a query
SELECT * FROM table WHERE date_logged BETWEEN 1181298303 AND 1181307071 ORDER BY date_logged ASC
// This will produce the following
// ID, Date_logged
1, 0.18, 1181298000
2, 0.74, 1181298060
3, 0.37, 1181298120
4, 0.74, 1181298180
5, 0.37, 1181298240
6, 0.55, 1181298300 ---|| //this is more than 900 sec
7, 0.92, 1181299500 ---||
8, 44.63,1181299560
9, 0.18, 1181299620
10, 25.55, 1181299780
11, 16.11, 1181299840
12, 46.67, 1181299900
13, 4.44, 1181299960
14, 58.70, 1181300020
15, 69.26, 1181300080
16, 85.93, 1181300140
17, 12.03, 1181300200 --|| this is more than 900 sec
18, 46.11, 1181301200 --||
19, 31.11, 1181301260
20, 54.81, 1181301320
Trip 1 = Record 1 to 6
Trip 2 = Record 7 to 17
Trip 3 = record 18 to 20
I would somehow like to be able to run a query and seperate the trips between two dates
also i would like to know the start_date / end date of each trip
I hope this is alot more clear
Thanks
Kenny
-
Jun 15, 2007, 08:44 #4
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
so, please show the actual results that you want the query to produce
-
Jun 15, 2007, 09:04 #5
- Join Date
- Dec 2002
- Location
- Manchester UK
- Posts
- 310
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Sure...
PHP Code:
<a href="page.php?start=1181298000&end=1181298300">Trip 1</a>
<a href="page.php?start=1181299500&end=1181300200 ">Trip 2</a>
<a href="page.php?start=1181301200&end=1181301320">Trip 3</a>
-
Jun 15, 2007, 09:10 #6
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
my advice:
run your simple query, loop over the results with php, detect the gaps which are greater than 900, and handle accordingly
to do this with SQL is ~way~ complex
-
Jun 16, 2007, 01:58 #7
- Join Date
- Dec 2002
- Location
- Manchester UK
- Posts
- 310
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi,
Do you have any Idea on how to do this with PHP?
Thanks
K-
-
Jun 16, 2007, 06:57 #8
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
Bookmarks