Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 11-26-2022, 07:39 PM   #1
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 652
Sortable date on page from 3 seperate columns?

Is this possible to do?

I have a table that contains the following columns in it:

Month
Day
Year

The output on the page is:

December 15 2023
December 21 2023
December 02 2023

Is there a way that I can sort that data, if I'm pulling the date itself from 3 seperate columns using 3 echo statements?

Or, a better way to include the date in form input to put it into the sql table itself making it sortable?
__________________
PublisherBucks
Wellness Affiliate Program.
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-26-2022, 08:33 PM   #2
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,546
Quote:
Originally Posted by Publisher Bucks View Post
Is this possible to do?

I have a table that contains the following columns in it:

Month
Day
Year

The output on the page is:

December 15 2023
December 21 2023
December 02 2023

Is there a way that I can sort that data, if I'm pulling the date itself from 3 seperate columns using 3 echo statements?

Or, a better way to include the date in form input to put it into the sql table itself making it sortable?
Why do you have the dates split into month, day and year? And why 3 separate echo statements?

Anyway, you can concatenate the 3 columns together to make a sortable date.

Concat function: https://www.w3schools.com/sql/func_mysql_concat.asp


.
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-26-2022, 09:03 PM   #3
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 652
Quote:
Originally Posted by sarettah View Post
Why do you have the dates split into month, day and year? And why 3 separate echo statements?

Anyway, you can concatenate the 3 columns together to make a sortable date.

Concat function: https://www.w3schools.com/sql/func_mysql_concat.asp


.
So that when someone uploads they can choose a specific date for publication from a drop down menu, that was honestly the only way i knew how to achieve what i wanted lol

I'll take a look at that link, thanks
__________________
PublisherBucks
Wellness Affiliate Program.
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-26-2022, 09:10 PM   #4
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,546
Quote:
Originally Posted by Publisher Bucks View Post
So that when someone uploads they can choose a specific date for publication from a drop down menu, that was honestly the only way i knew how to achieve what i wanted lol

I'll take a look at that link, thanks
Do a pull from the database of id and concatenated date sorted by the concatenated date.

Make a dropdown using the id as the key and the concatenated date as the display value.

Then when they pick the date from the dropdown you can retrieve the data using the id.

.
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-26-2022, 09:45 PM   #5
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 652
Quote:
Originally Posted by sarettah View Post
Do a pull from the database of id and concatenated date sorted by the concatenated date.

Make a dropdown using the id as the key and the concatenated date as the display value.

Then when they pick the date from the dropdown you can retrieve the data using the id.

.
Awesome, thank you!
__________________
PublisherBucks
Wellness Affiliate Program.
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-27-2022, 12:03 AM   #6
fuzebox
making it rain
 
fuzebox's Avatar
 
Industry Role:
Join Date: Oct 2003
Location: seattle
Posts: 21,687
Quote:
Originally Posted by Publisher Bucks View Post
So that when someone uploads they can choose a specific date for publication from a drop down menu, that was honestly the only way i knew how to achieve what i wanted lol
fuzebox is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-27-2022, 08:12 AM   #7
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,546
Quote:
Originally Posted by Publisher Bucks View Post
So that when someone uploads they can choose a specific date for publication from a drop down menu, that was honestly the only way i knew how to achieve what i wanted lol
I re-read this this morning after Fuzebox quoted you.

Why not just use a date picker for that?

<input type="date"

https://www.w3schools.com/tags/att_input_type_date.asp


Not sure why you would have the month, year, day tabled in 3 columns if you are using the date as the publishing date for the user to pick from.

I assumed the table also had other data and you had just split your date up for some reason.

.
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-27-2022, 01:45 PM   #8
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 652
Quote:
Originally Posted by sarettah View Post
I
I assumed the table also had other data and you had just split your date up for some reason.

.
You assumed correctly, there are a couple of other fields in that table that relate to the document upload also.

For example, if someone is out who is supposed to publish a document, or the document doesnt pass qc, they can edit the field and set a future date.
__________________
PublisherBucks
Wellness Affiliate Program.
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-27-2022, 02:33 PM   #9
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,546
Quote:
Originally Posted by Publisher Bucks View Post
You assumed correctly, there are a couple of other fields in that table that relate to the document upload also.

For example, if someone is out who is supposed to publish a document, or the document doesnt pass qc, they can edit the field and set a future date.
But why are you splitting your date into 3 columns? Why not just store the date?

.
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-27-2022, 05:36 PM   #10
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 652
Quote:
Originally Posted by sarettah View Post
But why are you splitting your date into 3 columns? Why not just store the date?

.
Because when they publish they are published on specific dates, which correlate to the writing process and publication date of previous titles.

Maybe I'm not fully understanding what you are saying about storing the date? Doesnt that just do the same thing when stored?
__________________
PublisherBucks
Wellness Affiliate Program.
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-27-2022, 06:13 PM   #11
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,546
Quote:
Originally Posted by Publisher Bucks View Post
Because when they publish they are published on specific dates, which correlate to the writing process and publication date of previous titles.

Maybe I'm not fully understanding what you are saying about storing the date? Doesnt that just do the same thing when stored?

A date type field in the database is for storing a date. It is just one column, it does not split it into 3 pieces as you described.

Quote:
I have a table that contains the following columns in it:

Month
Day
Year
https://dev.mysql.com/doc/refman/8.0/en/datetime.html

Quote:
The DATE type is used for values with a date part but no time part. MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range is '1000-01-01' to '9999-12-31'.
So you would have the publish date as a date field in the db table.

On your recipe add/edit screen you would have the date as an input field on the screen.

On an add the field would be blank and the user would enter or pick the date for publishing. On the edit field, once the record was retrieved you would have the field populated with the current publish date and the user would be able to change it.

.
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-27-2022, 10:38 PM   #12
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 652
Quote:
Originally Posted by sarettah View Post
On an add the field would be blank and the user would enter or pick the date for publishing. On the edit field, once the record was retrieved you would have the field populated with the current publish date and the user would be able to change it.

.
Oh okay, I see what you're saying now, okay let me have a play about, that seems like it would actually be much simpler, thank you!
__________________
PublisherBucks
Wellness Affiliate Program.
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
december, date, columns, page, sortable, seperate, table, echo, sql, pulling, statements, include, input, form, output, month, day, sort, data



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.