mga_ka_php Posted May 12, 2009 Share Posted May 12, 2009 I have a table which contain an ID and Description ID | Description ------------------------------------------------------------------ 1 | Number:1033837|#|Date:2009-03-29|#|Canceled:YES.... Note: the date is within the Description Now, what i am trying to achieve is to get all the records less than the current timestamp But I don't know how to pullout the date within the description. example: SELECT * FROM table1 WHERE $current_timestamp > UNIX_TIMESTAMP( Date in the description column ) Quote Link to comment https://forums.phpfreaks.com/topic/157788-solved-is-this-possible/ Share on other sites More sharing options...
kickstart Posted May 12, 2009 Share Posted May 12, 2009 Hi You need to extract the date from the string with something like substr(Description,instr(Description,'Date')+5,10) or substr(substring_index(Description,'|',3),-10,10). Not likely to be efficient at all. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/157788-solved-is-this-possible/#findComment-832234 Share on other sites More sharing options...
mga_ka_php Posted May 12, 2009 Author Share Posted May 12, 2009 what if the location of the date is dynamic? because the date is not always on the 20th character for example. Quote Link to comment https://forums.phpfreaks.com/topic/157788-solved-is-this-possible/#findComment-832253 Share on other sites More sharing options...
kickstart Posted May 12, 2009 Share Posted May 12, 2009 Hi Neither would care. They would if the description field had "Date" in it earlier on (first one) or if the Date field wasn't the 3rd group of data (seperate by | ) in the description (2nd one). All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/157788-solved-is-this-possible/#findComment-832258 Share on other sites More sharing options...
mga_ka_php Posted May 12, 2009 Author Share Posted May 12, 2009 ok i got it now. thanks.this what i'm looking for. thank you. Quote Link to comment https://forums.phpfreaks.com/topic/157788-solved-is-this-possible/#findComment-832271 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.