Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-09-2004, 04:18 PM   #1
Paul Ferrie
Scottish and mad fer it!!
 
Paul Ferrie's Avatar
 
Join Date: Jun 2002
Location: uk/scotland/glasgow
Posts: 3,606
Default select * WHERE date = 109649880 (time stamp)

I am trying to breakup data returned form a mysql query.
I have a database "worklines"
int ther i have the table "noLines"

ddpID
ddpDate
ddpCount

The date will be set with "date();"
So this will store 109649880 in the database
i will have 100 plus rows in the table
i want to breakdown the data returned in order of months
so month 1 would return the 4 weeks for that month and so on for each month after

I think the query would be something like:
PHP Code:
mysql_query="SELECT * FROM worklines WHERE ddpDate=109649880;
// and so on for each month 
my problem is setting up each time stamp for each month.

I hope you get the picture
__________________
.:To me AS is like LEGO, Only for the big Kids :.
- InnovativeDesigns - Scotflash - About me
Paul Ferrie is offline   Reply With Quote
Old 10-19-2004, 09:41 AM   #2
marius
Registered User
 
Join Date: Feb 2003
Location: Bucharest, Romania
Posts: 76
Send a message via Yahoo to marius
Default

if i understand corectly you need to get the entries out of the database based on the week.
so then you do ..
select * from worklines where ddpDate>beginoftheweektimestamp and ddpDate<endoftheweektimestamp



is this what you need?
marius is offline   Reply With Quote
Old 10-19-2004, 01:04 PM   #3
thumbling
Registered User
 
Join Date: Jun 2004
Posts: 21
Default

nonononnono

SELECT * FROM TABLE WHERE date_format("%U", date) = 34;

(but you'd need a mysql datetime format for that, .. if you're able to change into that, please do. use unix_timestamp() to return the date again in epoch seconds)

or else use Marius' way, but rather with date BETWEEN beginoftheweektimestamp and endoftheweektimestamp;
thumbling is offline   Reply With Quote
Old 10-19-2004, 10:15 PM   #4
freddycodes
Master of Nothing
 
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
Default

Maybe webdreamer would clarify do you want to list one month at a time? Or all data split up my month?

There is nothing wrong with storing as unix time. You can still format dates wit DATE_FORMAT and unix time stamps
http://mysql.he.net/doc/mysql/en/Dat...s.html#IDX1421

SELECT * FROM TABLE WHERE date_format("%U", FROM_UNIXTIME(date)) = 34;
freddycodes is offline   Reply With Quote
Old 10-21-2004, 01:15 PM   #5
Paul Ferrie
Scottish and mad fer it!!
 
Paul Ferrie's Avatar
 
Join Date: Jun 2002
Location: uk/scotland/glasgow
Posts: 3,606
Angry

What i want to do is display 5 working days of each week of the month.
After spending a view days tinkering about i am still know further forward
Example:
http://www.innovativedesigns.org.uk/test/lines.html
As you will see all data is loaded into the buttons, this is not what i want!

What i want is to load each month into the buttons
So with the data i have ther would be 3 buttons
Augast
September
October

When you click on one of these months a futher row of buttons will appear. These will be the weeks of that month you just clicked.
Now when you click on one of the weeks of that month it will load the 5 days into the graph. all fairly simple except i cant get it to work


Cheers
Paul
__________________
.:To me AS is like LEGO, Only for the big Kids :.
- InnovativeDesigns - Scotflash - About me
Paul Ferrie is offline   Reply With Quote
Old 11-06-2004, 04:04 AM   #6
tddlard
Registered User
 
Join Date: Nov 2004
Posts: 11
Default

This seems to me like it requires some mysql and php interaction to get the data u need.

Code:
	SELECT DISTINCT DATE_FORMAT(ddpDate, %m), DATE_FORMAT(ddpDate, %Y) FROM worklines ORDER BY ddpDate DESC;
Once you have that information passed into php by your mouse event you can get the upper and lower timestamp for that month/year

PHP Code:
<?php
    
//assuming variables $month and $year

    
$lowerTS mktime(000$month1$year);
    
$upperTS mktime(235959$monthdate("t"$lowerTS), $year);
    
    
//date("t", $lowerTS) gives us the number of days in the month
?>
You would then get that months data

PHP Code:
<?php
    mysql_query
("SELECT * FROM worklines WHERE UNIX_TIMESTAMP(ddpDate) BETWEEN " $lowerTS " AND " $upperTS " ORDER BY ddpDate DESC;");
?>
This should get you where you want to be!
tddlard is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:19 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.