Quickly Enter Today’s Date in phpMyAdmin
With the date-field types, phpMyAdmin provides a pop-up calendar for quickly selecting a time frame. However, I commonly create new entries by editing an old row and choosing the "Insert as new row" option. Using older entries causes the calendar to show dates based on the original entry. Since phpMyAdmin doesn't have an option for jumping to today's date, I end up clicking through the calendar options or typing the date manually. Well there's another, sometimes faster, way.
Background
One database table I maintain contains news entries for a website. Some entries, like the ones for annual reports, don't change much from year to year. So I speed up the data-entry process by searching for last year's post to use it like a template.
For those unfamiliar with creating new database entries by editing old ones, let's run through the general steps. Of course, you'll need to be logged into phpMyAdmin.
- Locate the old entry (note that phpMyAdmin has a "Search" tab near the top)
- Click the edit icon
- Scroll to the bottom of the form and change the drop-down menu from "Save" to "Insert as new row" (see Figure 1)
- Update the entry as needed
- If your table has a primary key that auto-increments, the value needs to be cleared. That way the new entry gets its own key.
- Click Go
Figure 1. Insert as New Row Option
Getting Today's Date
When editing an old database entry to create a new one, notice that the pop-up calendar for date fields shows the old date (see Figure 2).
Figure 2. Calendar Using Old Date
Instead of clicking through options to get today's date (or typing the date manually), there is another option. You just need to clear out the old date before viewing the calendar (see Figure 3).
Figure 3. Calendar Using Today's Date
Conclusion
Now it would be better if phpMyAdmin provided a button for jumping to the current date. But until that happens, we have relatively quick way of getting today's date.
0 Comments
There are currently no comments.
Leave a Comment