Tag Archives: mysql

Sort by specific order in MySQL query

If you want to sort the list by a certain order, such as a list of numbers from the beginning of 4,5,1, and then in ascending order, you can create a sort order by IF statement rule with additional columns … Continue reading

Posted in Programming | Tagged , , , | Leave a comment

Local date format in PHP or MySQL

If locale is installed on the server then with PHP: For MySQL local date:

Posted in Programming | Tagged , , , | Leave a comment

Calculate days between dates

Using php strtotime function difference between dates: Another way to set date with mktime function: Before PHP 5.1.0 negative timestamps were not supported. Under any known version of Windows date could be from 1970 to 2038 years. And using MySQL … Continue reading

Posted in Programming | Tagged , , , , , , , | Leave a comment

Delete WordPress users with no posts by MySQL query

Back up your database regularly, and always before any upgrade. This query delete wordpress users (and they meta info) with no posts: This query select users with no posts: This query select users with no posts and no comments:

Posted in WordPress | Tagged , , , | 4 Comments