PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm trying to create a one file shoutbox that can show and post shouts. However, I'm having some difficulties inserting the data. The data gets inserted twice. Also, when I view the shouts, only the newest row from the table is displayed. Heres the code:
Database native date-time format is YYYY-MM-DD HH:MM:SS. This is for several reasons, mostly, simple sorting and uniformity. Your code shows that you are storing in another format. I would like to understand why you chose to not use the native format (and field type.)
feyd wrote:Database native date-time format is YYYY-MM-DD HH:MM:SS. This is for several reasons, mostly, simple sorting and uniformity. Your code shows that you are storing in another format. I would like to understand why you chose to not use the native format (and field type.)
You know, I never quite understood that (or cared to look for it) until you said sorting. I thought it was annoying for print dates, but that makes perfect sense.
And I can definitely see passing a date() in a different format than your database deals with causing a problem
An added problem with using your own format for dates is that you more than likely will not be able to extract information in given date ranges easily. Because of the natural ability to sort perfectly in native format, it's VERY simple to find entries between two dates.