Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a MySQL project in which I made some shift planing system. I am using PHPmyAdmin in which I create the tables (which I coded for it to be shown via PHP). I want to create a datepicker for the table to be shown since there are 360 columns. Is it possible to make the column names and then for this to later be recognized by a datepicker?

I am very sorry for the lack of specifics. I haven't worked long with SQL.

What I have tried:

I have tried coding the datepicker via Range. It doesn't recognize much. The datepicker works, but not the range recognition.
Posted
Updated 16-Feb-22 9:24am
v3

1 solution

Quote:
Is it possible
Yes, a good decision? Maybe no.
Quote:
Is it posible to make the column names and then this later be recognized by a Date picker?
Changing the data type of the columns is very challenging, especially once the database is in production. Based on your traffic quality and quantity you might have to opt for one of the migration processes. You would need to add temporary columns, then move the data, then... You get the point. No? Please read this: sql server - SQL change column datatype in production - Server Fault[^], Changing data type of a column in production database[^].

If I had to do this, I would keep the column names as they are. Leave the name column for the name data and for the date picker I would create a new column with DEFAULT value set to NULL (because existing records would contain NULL for this, or just provide a past date). Then, if I no longer need the name column, I would first stop using it. Then, once I know that my application (or my users' apps, in case I am selling the product as a platform) is not using this column I would remove it.

The removal part is entirely up to the business requirements. Often, you would just leave the data there. But, that's up to you.
Quote:
I have tried coding the date picker via Range. It doesnt recognize much the datepicker works but still not the range recognition.
If you want to query the data between two dates, why not just rely on the good old BETWEEN clause[^]? In this scenario, I would create a column for the date, and then write the query that fetches the records that are between two dates.

The date picker part is confusing. It is just a JavaScript plugin, right? You can create two of these, get their input and send in the query.

Oh, and when you send this information in query make sure that your SQL queries are sanitized against SQL Injection[^].
 
Share this answer
 
Comments
Ajimus Espinosa 17-Feb-22 3:28am    
Thank you very much! Did you build something similar? This is a uni project.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900