![]() |
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? |
Quote:
Anyway, you can concatenate the 3 columns together to make a sortable date. Concat function: https://www.w3schools.com/sql/func_mysql_concat.asp . |
Quote:
I'll take a look at that link, thanks :) |
Quote:
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. . |
Quote:
|
Quote:
|
Quote:
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. . |
Quote:
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. |
Quote:
. |
Quote:
Maybe I'm not fully understanding what you are saying about storing the date? Doesnt that just do the same thing when stored? :Oh crap |
Quote:
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:
Quote:
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. . |
Quote:
|
All times are GMT -7. The time now is 02:10 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123