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 [...]
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 );
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 [...]
Sometimes when debugging an application you need to see all global variables. In PHP there is an easy way: $defined_vars = get_defined_vars(); print_r($defined_vars);
Printing a new line witch is visible in a web page is made like this: echo(‘line 1′.‘\n‘.‘line 2′); the code above will print line 1 on a line and line 2 on a new line. Now if you have to generate a CSV file <br/> wil not work you have to use \n like [...]
Browsing phpclasses.org I had found a very interesting article Neural Networks in PHP . For anyone who dont know yet “Neural networks allow emulating the behavior of a human brain in software applications.” In this article you can read how to implement Neural Mesh to develop Neural Network applications in PHP. (Neural Networks in PHP) [...]
mysql -u USER -p DBNAME < dump.sql Where: USER is your username DBNAME is Databas witch will be restored dump.sql (any .sql file can be used) is your database dump
When you insert or update a date in a mysql Table you have to remember that Mysql have 3 types of date DATETIME ( default format 0000-00-00 00:00:00 ) DATE ( default format 0000-00-00 ) TIMESTAMP ( default format 0000-00-00 00:00:00 ) PHP code: DATE -> $mysqldate = date( ‘Y-m-d’ ); DATETIME, TSTAMP [...]
TINYINT A very small integer The signed range is –128 to 127. The unsigned range is 0 to 255. SMALLINT A small integer The signed range is –32768 to 32767. The unsigned range is 0 to 65535 MEDIUMINT A medium-size integer The signed range is –8388608 to 8388607. The unsigned range is 0 to 16777215 [...]