Call   0208 3131682   Mon-Fri 9am-6pm


WordPress SQL snippets

By | PHP, SQL, Wordpress | No Comments

A place to keep snippets of useful WordPress SQL.

Do a select based on some meta field of a post ( i.e. search for a post that has a particular metafield  )
In the example above I’m searching for posts with a value for id_vim_node. This is based on this code from stackexchange

Output WP_Query sql code (very useful for debugging WP_Query )

if in the loop

outside of loop

based on this post on stackexchange

Importing a MAMP mysql database on mac (OS X Yosemite)

By | Mysql, PHP, SQL | No Comments

How to import a MAMP mysql database (bypassing phpmyadmin problems)

Recently I’ve being have a problem importing a large database in MAMP Mysql via phpmyadmin (and after altering various php variables in php.ini, I still couldn’t get it to import).

So I tried another approach to import it from the command line a quick google turned up this post on the MAMP site which got me started.

I managed to import the database fine from the command line like this:



it might warn you about password being insecure via the command line.


I hope you find this helpful to overcome problems importing MAMP mysql databases using Phpmyadmin ( simply by using the command line).



Handy Woocommerce SQL queries

By | PHP, SQL, Woocommerce | 4 Comments

This post is just a place to store handy SQL queries for Woocommerce.

Get Order and all its information


Get Users and billing and shipping addresses in Woocommerce

this bit of sql is based on this post at

Get Order Objects (not strictly sql, but seems a good place to drop it)