Website’s

PHP: trim spaces in the middle of a string

Posted by admin on February 14, 2011 at 1:29 pm

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. /* [...]

MySQL: Select “last month” records

Posted by admin on February 4, 2011 at 2:27 pm

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 [...]

MySQL: select “this month” records

Posted by admin on February 4, 2011 at 2:20 pm

Where “date” column is a Date type in “my_table” SELECT * FROM `my_table` WHERE YEAR(`DATE`) = YEAR(CURDATE()) AND MONTH(`DATE`) = MONTH(CURDATE())

MySQL: Select last 7 days records

Posted by admin on February 4, 2011 at 2:14 pm

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()

MySQL: Select today, yesterday or day before yesterday records

Posted by admin on January 10, 2011 at 11:29 am

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 [...]

Make your own custom Facebook and Twitter share buttons

Posted by admin on December 11, 2010 at 9:53 pm

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 [...]

Prepare for Christmas with free Social Media Christmas Icons

Posted by admin on December 11, 2010 at 5:57 pm

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

Substract 1 hour from current date in PHP

Posted by admin on December 8, 2010 at 9:41 am

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 );

1400 free icon pack from FatCow

Posted by admin on December 7, 2010 at 9:55 pm

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 [...]

Getting phpDocumentor to work

Posted by admin on November 25, 2010 at 4:39 pm

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 [...]