How To Delete Pingbacks, Spam Comments and Unused Tags in WordPress

WordPress is a great CMS, but it can get cluttered over time, and there’s no better way to remove all the unnecessary junk than to go clean it up in MySQL. Here are 3 quick SQL queries you can run to clean up your MySQL database. SQL command to delete all spam comments in WordPress: [...]

Continue reading...

How To Use SQL To Delete All Posts In A WordPress Category

How To Use SQL To Delete All Posts In A WordPress Category

This handy script allows you to delete all posts and all their related content from your WordPress installation…PERMANENTLY. Please use it with CAUTION and always perform backups! Use this script only at your own risk. Step 1: First you need to log into your phpMyAdmin and select your WordPress database. Step 2: From the horizontal [...]

Continue reading...

How To Protect Your Websites Against SQL Injection Attacks

How To Protect Your Websites Against SQL Injection Attacks

If not protected properly, websites can be vulnerable to SQL injection attacks. A layered approach to thwart SQL injection attacks provides a good defense. The following provide just some ways that you can adopt to start protecting your websites. 1. Sanitize the input The first thing you need to do is to make sure that [...]

Continue reading...

How To Move OpenCart Folder (Change OpenCart’s Installed Location)

How To Move OpenCart (Change OpenCart's Installed Location)

Let’s assume that you’ve installed OpenCart at http://www.YourDomain.com/Shop/ and you want to move it to http://www.YourDomain.com/ now. To make this change and move OpenCart from folder to folder, you’ll need to edit the following two files: http://www.domain/Shop/config.php and http://www.domain/Shop/admin/config.php You’ll find many lines in the two files that look like this: define(‘HTTP_SERVER’, ‘http://www.YourDomain.com/shop/’); Simply change [...]

Continue reading...

How To Remove The Last Character in a String

How To Remove The Last Character in a String

To remove the last character (or the last X characters) of a string, just use PHP’s substr_replace() function. Basically, you just need to tell the function to replace the last character of a string (or the last X characters) with nothing. Here’s a code sample: $old_string = “One, Two, Three,”; // remove the last comma [...]

Continue reading...

How To Process Multiple SQL Statements

How To Process Multiple SQL Statements

Sometimes you’ll find yourself needing to execute multiple statements at once. The normal mysql() class only allows for single statements, but the recent mysqli() offers this functionality. To use it, follow this code example:

Continue reading...

How To Split Comma-separated Values

How To Split Comma-separated Values

To split a string that contains values separated by commas (comma-separated values), what you need is the PHP explode() function. Here’s a code example on how to use the explode() function: $cake = “slice1,slice2,slice3,slice4″; $slices = explode(“,”, $cake); echo $slices[0]; // slice1 echo $slices[1]; // slice2 And if you have a space after your comma, [...]

Continue reading...

Best CodeIgniter Web Hosting

Best CodeIgniter Web Hosting

Unlike other PHP frameworks, CodeIgniter has a very light footprint and is more flexible in terms of web hosting requirements. As a result, CodeIgniter allows you to run off pretty much any standard PHP hosting package (running off either Linux or Windows). The only thing that you should consider is then your own site’s traffic [...]

Continue reading...

How To Customise URLs and Create SEO-Friendly URLs in CodeIgniter

How To Customise URLs and Create SEO-Friendly URLs in CodeIgniter

CodeIgniter, the PHP framework, allows for URL customization so that the URLs are more friendly to search engines. As a rule of thumb when you deal with URLs, it is best to avoid long URLs. To shorten your CodeIgniter URLs, for e.g. changing the default controller/method format in the URLs to just reflect the method [...]

Continue reading...

How To Store Arrays In MySQL / PHP

How To Store Arrays In MySQL / PHP

Arrays are the best tool in the PHP language if you’re dealing with associative data. However, it’s one thing to be manipulating arrays, but what if you need to store the entire array in a database? Structuring your database table so that you don’t have to store entire arrays should be your first priority, but [...]

Continue reading...