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:
1 |
vagrant up |
Sometimes I…
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…
To change the time when your login session gets expired go to the root of your phpmyadmin folder and find the file config.inc.php 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.
1 |
$cfg['LoginCookieValidity'] = 3600 * 5; |
Execute this SQL and just replace table_name with the table you want to reset.
1 |
ALTER TABLE table_name AUTO_INCREMENT=0 |
Just replace the new_table with the name of your new table and existing_table with the table you want to duplicate
1 |
CREATE TABLE new_table SELECT * FROM existing_table |
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.
1 |
UPDATE table_name SET table_field = REPLACE(table_field, 'value', 'new_value') WHERE my_field LIKE '%value%'; |