:::: MENU ::::
Posts tagged with: mysql

MySQL: Select “last month” records

In order to select last month records you have to get first day of the last month and the last day of the first month. With this you use the mysql function BETWEEN.

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 last thay of the last month:

LAST_DAY(CURRENT_DATE – INTERVAL 1 MONTH)

And the final Query is:

SELECT *
FROM `my_table`
`DATE` BETWEEN DATE_FORMAT(CURRENT_DATE – INTERVAL 1 MONTH, "%Y-%m-01") AND LAST_DAY(CURRENT_DATE – INTERVAL 1 MONTH)

MySQL: Select today, yesterday or day before yesterday records

Usually when you work with records where a date or time-stamp 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 type fieldWatch movie online John Wick: Chapter 2 (2017)

Today records:

SELECT *
FROM `my_table`
WHERE `Date` = CURDATE()

Continue Reading


Neural Networks in PHP

Browsing phpclasses.org I had found a very interesting article Neural Networks in PHP . For anyone who don’t 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)

Neural Meshis an open source, pure PHP code based Neural Network manager and framework that makes it easier to work with Neural Networks.

Neural Mesh home page: http://neuralmesh.com/

  • Pure PHP & MySQl
  • Adaptive Learning
  • Implement in any enviroment
  • Web Api
  • Fast