When you let users input text in a textfield or input box iti is always a good ideea to use trim function to remove spaces form the begining or the end of the string. Today I needed a function to trim spaces from the middle of a string and replace with a single space. /* [...]
In order to select last month records you have to get first dai of the last month and the last day of the first month. Remember that current month could be January and the last month will in another year. Finding first day of the last month: DATE_FORMAT(CURRENT_DATE – INTERVAL 1 MONTH, "%Y-%m-01") Finding the [...]
Where “date” column is a Date type in “my_table” SELECT * FROM `my_table` WHERE YEAR(`DATE`) = YEAR(CURDATE()) AND MONTH(`DATE`) = MONTH(CURDATE())
For this example I use this table model: ID Name Date 1 Jon Dow 2011-01-10 2 Jane Dow 2011-01-10 … … … SELECT * FROM `my_table` WHERE `DATE` BETWEEN DATE_ADD(CURDATE(), INTERVAL -5 DAY) AND CURDATE()
Usualy when you work with records where a date or timestamp field is present you need to select records from: today records yesterday records day before yesterday records Lets say you have a table (my_table) like this: ID Name Date 1 Jon Dow 2011-01-10 2 Jane Dow 2011-01-10 … … … where `Date` is date [...]
Sometimes Share button from Facebook and Twit button from Twitter do not fit in your website/blog. So you design a great Share button Image but how to link it to your own article with title and permalink. For Twitter: – send the visitor to this link: http://twitter.com/share?_=1292093673417&count=horizontal&original_referer=your_page_link_url_encoded&related=your_twitter_account&text=page_title_or_text_html_encoded&url=your_page_link_url_encoded&via=your_twitter_account If you want to implement this in WordPress [...]
Xmas Icons! You can download this free icon set using the link below: Download XmasIcons.zip Christmas Social Bookmark You can download this free icon set using the link below: Download PNG, WIN, MAC
This 3 lines will give you the current date minus 1 hour: $date = date("d-m-Y H:i"); $newdate = strtotime ( ‘-1 hour’ , strtotime ( $date ) ) ; $newdateStr = date (‘d-m-Y H:i’ , $newdate );
You can find in this free icon pack 1400 png icons in 16 x 16 and 32 x 32 pixel format. Icon Pack Name: Farm-Fresh Web Icon Developer: FatCow Download icon pack from here. This Icon Pack is free for private and commercial use and do not require a link back. For more informations check [...]
Today I needed phpDocumentor to work but after install surprinse !!! Is not working. In every documentation generated by phpdoc a Smarty error is present: Warning: Smarty error: unable to read resource: “pkgelementindex.tpl” in … or Warning: Smarty error: unable to read resource: “top_frame.tpl” in … or … So after hours of code debbuging I found that [...]