PHP webdeveloper and frontend developer

Vagrant up errors on install on Mac OS X

Category : PHP, MySQL, Mac and Apple stuff · No Comments · by Jan 23rd, 2014

Instead of MAMP I use Vagrant to set up my virtualhosts locally. That way you can emulate your webserver’s setup. To configure my Vagrant virtual machine I use PuPHPet. You need to have VirtualBox installed for this. After downloading the  PuPHPet configuration manifest you need to start up the virtual box. You do this by executing this command:

 Sometimes I…

Running database queries in WordPress

Category : Web development, MySQL, Wordpress · (6) Comments · by Feb 24th, 2013

WordPress has a built-in object class for dealing with database queries. It’s called wpdb and it’s found in the includes/wp-db.php file. When you’re running queries you should always use this class to execute them. To use this class you first need to define $wpdb as a global variable before you can use it. Just place this line of code before…

Change login session time for PHPMyAdmin

Category : PHP, MySQL · No Comments · by Nov 3rd, 2012

To change the time when your login session gets expired go to the root of your phpmyadmin folder and find the file Now search for this variable -> $cfg[‘LoginCookieValidity’]  In my example I changed it to 5 hours. You should also check the session.gc_maxlifetime in you php.ini file. The lowest value of those two will be in effect.

Resetting the auto increment number with MySQL

Category : MySQL · No Comments · by Jan 20th, 2012

Execute this SQL and just replace table_name with the table you want to reset.


Duplicate a database table with MySQL

Category : MySQL · No Comments · by Sep 27th, 2010

Just replace the new_table with the name of your new table and existing_table with the table you want to duplicate


MySQL replace function – Find and replace values in database with sql

Category : MySQL · No Comments · by Jan 12th, 2010

A great piece of sql that can save you a lot of time. The replace sql function finds and replaces values in a database. Just fill in the table_name, table_field, the value your searching for and with which value you want to replace it with.