This replace will search in every row of the table where condition from WHERE is true and replace function will replace all instances in a string. ex. if you have text “hello world” and you want to replace the “o” letter with “*” this will will transform the text in “hell* w*rld” UPDATE `mytable` SET [...]
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 [...]
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 [...]