close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Date Order Issue and Dynamic Dates...

Thread began 12/08/2010 10:34 am by iamdan356160 | Last modified 12/14/2010 9:37 am by Jason Byrnes | 3507 views | 9 replies |

iamdan356160

Date Order Issue and Dynamic Dates...

Hi all,
I have 2 quick questions...

Number 1 - Date Order Issue...
I have a field in my database named 'User_JoinDate' and the date is being written in the following format yyyy-mm-dd. For some reason, when the dates are displayed in the chart generated by DWC, they appear in the following order...
Dec 5,2010
Dec 6,2010
Dec 7,2010
Dec 8,2010
Dec 2,2010
Dec 3,2010

Any ideas why the dates are not ordering them self correctly?

Number 2 - Adding dynamic dates to mySQL statement...
Currently my SQL statement looks like this...

WHERE User_JoinDate >= '2010-12-02' AND User_JoinDate <= '2010-12-08' AND User_AccountType = 'free'

How can I write this statement so that the dates are not hard coded? For example... the 'Date From' to be dynamically written to 7 days ago from today's date and the 'To Date' dynamically written to be today's date? Does that make sense?

Any help would be greatly appreciated! Thanks in advance!

Dan

Sign in to reply to this post

Jason ByrnesWebAssist

Do you have an order by clause in the SQL:
WHERE User_JoinDate >= '2010-12-02' AND User_JoinDate <= '2010-12-08' AND User_AccountType = 'free' ORDER BY User_JoinDate ASC



you can use the MySQL CURDATE() command to return the currant date and use DATE_SUB to subtract 7 days
CURDATE()
DATE_SUB(CURDATE(),INTERVAL 7 DAY)

or
WHERE User_JoinDate >= 'DATE_SUB(CURDATE(),INTERVAL 7 DAY)' AND User_JoinDate <= 'CURDATE()' AND User_AccountType = 'free' ORDER BY User_JoinDate ASC



see the mysql page for more details on date and time functions:
date-and-time-functions.html

Sign in to reply to this post

iamdan356160

Thank Jason...
My SQL had (written by DWC)... 'ORDER BY DAYOFWEEK(User_JoinDate) ASC'
Changed it to your suggestion and its put them in the correct order!...

Also the date function works great! Thought I do have another quick question...

If these are the dates in the records that are pulled into the chart... you'll notice that the 4th December is missing...

Dec 2,2010 = 9 Users
Dec 3,2010 = 3 Users
Dec 5,2010 = 3 Users
Dec 6,2010 = 5 Users
Dec 7,2010 = 2 Users
Dec 8,2010 = 1 Users

because no one signed up on that day. I want the chart to be able to show the last 7 days of activity... So I'd like the 4th to appear in the chart... but show that there were zero records on that day OR if no one signed up all week, it would just show a flat line of along the 0 axis. How can I do this??

Sign in to reply to this post

Jason ByrnesWebAssist

the chart can only display value s that are in the database. It cannot show values that dont exist in the database.

Sign in to reply to this post

iamdan356160

Why is it when I remove all free members for the past 7 days I get 2 instances of the line that reads... '# of free members per week?' Please see attached example...
Thank you!

Sign in to reply to this post

Jason ByrnesWebAssist

honest answer: I dont know.


send a copy of your page and a copy of the DynamicWebCharts folder so i can examine the code.

Sign in to reply to this post

iamdan356160

Here you go... (I've added the page to the same folder - home.php)
Many Thanks,

Dan

Attached Files
DynamicWebCharts.zip
Sign in to reply to this post

Jason ByrnesWebAssist

i cant see anything in the code to cause this nor can i reproduce it.


can you send a link?

Sign in to reply to this post

iamdan356160

Can you send me a direct email address that I can send login details to please Jason?

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...