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!
What's weird is it shows up as 2007-05-22 00:00:00 in the databases and the code I gave is the whole thing with the exception of mysql_query($query,$connection) (which executes successfully). The rest of the stuff inserted is just post variables.
CREATE TABLE `table` (`date` DATE default CURRENT_DATE);
You should avoid doing this unless the database server is on the SAME server as PHP.
The reason is because I have found many hosting companies do not sync the dates between all of their servers properly. I have seen the database server be as much as a few days off compared to the PHP server. So you should always create the date using PHP and store it in the database. It will avoid a host of problems.
Last edited by AKA Panama Jack on Sat Jun 02, 2007 2:47 pm, edited 2 times in total.
AKA Panama Jack wrote:I have seen the database server be as much as a few days off compared to the PHP server. So you should always create the date using PHP and store it in the database. It will avoid a host of problems.
Oh. Well, back to coding. :-p
Would you suggest I still use the datetime type, or just a varchar/text?
Sure, it's best to use the datetime datatype because it will allow the database to perform date and time searches faster and easier. Just create the date and time using PHP based upon the clock PHP is using and store that information in the datetime field.