Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2004071

Re: [PHP-DB] Storing Date in mysql From: Pablo M. Rivas (pmrivas01 <email protected>)
Date: 07/08/04

Hello Michael,
    token_date must be a DATE FIELD...

    http://dev.mysql.com/doc/mysql/en/Column_types.html
    

MG> Hello,

MG> I need to store the date of record / entry in the mysql database, so I have the following table create statement:

MG> CREATE TABLE `token_table` (
MG> `token_id` int(11) NOT NULL auto_increment,
MG> `token_utuser_id` int(11) NOT NULL default '0',
MG> `token_name` varchar(100) NOT NULL default '',
MG> `token_date` varchar(100) NOT NULL default '',
MG> `token_user_id` varchar(100) default '',
MG> `token_ticket_id` varchar(100) default '',
MG> `token_data` varchar(100) default '',
MG> PRIMARY KEY (`token_id`),
MG> KEY `tokencheck` (`token_utuser_id`,`token_name`)
MG> ) TYPE=MyISAM;

MG> So in the token_date field I am storing the date in the following format from PHP:

MG> date("d/m/Y") which creates the following entry "05/07/2004" (example).

MG> I would like to know fro the list is ... is this the best way to store the date ? Would this be easy to select against ?

MG> Michael.

-- 
Best regards,
 Pablo

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php