close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Sorting and date questions

Thread began 5/24/2010 11:15 pm by freiheit | Last modified 5/25/2010 2:51 pm by Eric Mittman | 577 views | 1 replies |

freiheit

Sorting and date questions

Hello i want to ask you 2 things that i need to get done.

1st) I have made a page that lists some data pulled from a database , and i want to sort them by date asc , desc with a jump menu.

The date inserted in to the database has the format yyyy-mm-dd . I made this little script that currently do the job

<?php
$timestamp = strtotime($row_kiniseis['date']);
$newdate = date("l d F Y", $timestamp);
echo $newdate;
?>

Now the "problem" is that when i insert a record i type the date format in to the text box, like i mentioned above (yyyy-mm-dd) cause in any other case the data base shows "0000-00-00"

<----Is they any way to type the date format dd--mm-yyyy and this will be stored in the database as yyyy-mm-dd?---->

I tried to display the date in my native language format (greek) using a function with 2 arrays for months and days , but the table i display the data (and also the date) is inside a repeated region and i was receiving a notice that the function has already be declared.

<----Is there any solution-work arround with this issue?---->



2nd)To sort data by date using a jump menu do i need a relational table with id , values= asc,desc, and description?

Or this can be done with an easier way?With data assist maybe?

Sorry if my mind goes to the harder first :)

Sign in to reply to this post

Eric Mittman

When it comes to inserting the date in the correct format you will need to ensure that any insert or updates that you have format the date correctly before inserting it. You can use the regular php date formatting to do so like this:

php:
date("Y-m-d", strtotime($_POST['the_date']));



This way it should not matter how the date is being entered as it will always be reformated to the YYYY-mm-dd format when it is being inserted or updated.

For the error you are getting with your script being declared more than once you should make sure that you do not have the function definition in the loop as well.

To sort with a jump menu you can make use of the DataAssist Sort server behavior. It will allow you to toggle the sort order based on a particular column. To sort based on a column you do not need any special relationship with the info in that column. We have a solution recipe on this in the DataAssist support page, here is a link:

dataassist/

It is titled 'sorting columns by link', check this out to get a good idea of how to use the sort server behavior.

Sign in to reply to this post

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...