Category: MySQL

MySQL – Get all sundays in a month

To  get all the Sundays or Saturdays or Mondays you can use the following MySQL code Sunday DAYOFWEEK(DATE_ADD(‘2014-10-01’, INTERVAL ROW DAY))=1 Monday DAYOFWEEK(DATE_ADD(‘2014-10-01’, INTERVAL ROW DAY))=2 Tuesday DAYOFWEEK(DATE_ADD(‘2014-10-01’, INTERVAL ROW DAY))=3 Thursday DAYOFWEEK(DATE_ADD(‘2014-10-01’, INTERVAL...

Hide database from user

Hide database from user

These two queries will restrict a user to a single database, so that the user can only see, update, and delete tables from that single database: Replace USER with the MySQL username Replace USERDATABASE...

Restoring a MySQL table back to the database

Restoring a MySQL table back to the database

When we need to restore a single MySQL table from big data MySQL backup.  Most modern text editors should be able to handle a text file that size, if your system is up to it....

PHP Client IP address

PHP Client IP address

Many times we need the visitor’s ipaddress for validation, security, spam prevention, etc. Getting the Visitor’s ipaddress is very easy in PHP. The simplest way to get the visitor’s/client’s ipaddress is using the$_SERVER[‘REMOTE_ADDR’] or $_SERVER[‘REMOTE_HOST’] variables. 1...

Simple shell script to backup MySQL databases

Simple shell script to backup MySQL databases

Simple shell script to backup MySQL databases.

Example output (with mysql password stored inside script):

CodeIgniter Dropdown filtering with Ajax

CodeIgniter Dropdown filtering with Ajax

Rather than using pure php, when it comes to a framework, working with ajax become much tricky. Since codeigniter using inbuilt MVC architecture, we have to consider the routing pattern of the application as...