shamsuljewel Posted January 26, 2008 Share Posted January 26, 2008 Hi guys..I am using time function to insert a data to the table INSERT INTO table(name,insert_date) Values('$name','time()') so when I want to search a specific name on specific date by mysql query how should I do it? coz time() function insert 01022332 like this valu how should I search a date suppose 2008-01-21 entries? Link to comment https://forums.phpfreaks.com/topic/87894-time-function/ Share on other sites More sharing options...
Nhoj Posted January 26, 2008 Share Posted January 26, 2008 "SELECT * FROM `table` WHERE `time` > UNIX_TIMESTAMP('2008-01-21 12:00:00');" Link to comment https://forums.phpfreaks.com/topic/87894-time-function/#findComment-449707 Share on other sites More sharing options...
laffin Posted January 26, 2008 Share Posted January 26, 2008 that depends on your SQL creation for that field but it wud be easier if ur SQL was in date or datetime format. which makes building the query much easier than working with time() formats. use now() instead in the query and either date or datetime in the creation of yer table fields. Link to comment https://forums.phpfreaks.com/topic/87894-time-function/#findComment-449709 Share on other sites More sharing options...
shamsuljewel Posted January 26, 2008 Author Share Posted January 26, 2008 Yes I know date function is much more easier to handle. thanks laffin and Nhoj. Link to comment https://forums.phpfreaks.com/topic/87894-time-function/#findComment-449720 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.