How to get query string values in JavaScript

Hi, Getting query string value in Php is easy you can use global variable like $_GET, $_POST, $_REQUEST. But in case of JavaScript. How you can get it. Here is a simple method you can use to get the value of a query string with JavaScript:

function getParameterByName(name, url) {
    if (!url) url = window.location.href;
    name = name.replace(/[\[\]]/g, "\\$&");
    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, " "));


// query string like :
  var location = getParameterByName('location'); // "lorem"

WordPress Plugin for Page Redirection

Hi guys some time you need WordPress plugin for pages redirection or direction custom url to any url in your wordpress project. In this article I am suggesting you a a best wordpress plugin.”Safe Redirect Manager” is a free plugin available on wordpress repository. Safe Redirect Manager is a HTTP redirect manager for WordPress. An easy-to-use UI allows you to redirect locations to new URL’s with the HTTP status codes of your choosing. The plugin uses the wp_safe_redirect function which only allows redirects to whitelisted hosts for security purposes. The plugin automatically handles whitelisting hosts for you. This plugin works great with Multisite.

Here you can download it. Click Here

What is difference between SOAP and REST web services ?

There are many differences between SOAP and RESTful web services.

SOAP is a protocol. REST is an architectural style.
SOAP stands for Simple Object Access Protocol. REST stands for Representational State Transfer.
SOAP can’t use REST because it is a protocol. REST can use SOAP web services because it is a concept and can use any protocol like HTTP, SOAP.
JAX-WS (Java API for XML Web Services) is the java API for SOAP web services. JAX-RS(Java API for RESTful Web Services) is the java API for RESTful web services.
SOAP defines standards to be strictly followed. REST does not define too much standards like SOAP.
SOAP permits XML data format only. REST permits different data format such as Plain text, HTML, XML, JSON etc.
SOAP defines its own security. RESTful web services inherits security measures from the underlying transport.
SOAP requires more bandwidth and resource than REST. REST requires less bandwidth and resource than SOAP.
SOAP uses services interfaces to expose the business logic. REST uses URI to expose business logic.
SOAP is slower than REST. REST is much more lightweight and faster.
SOAP is less preferred than REST. REST more preferred than SOAP.

How to increase maximum upload and PHP Memory limit in wordpress

WordPress has a modest limit for uploading images, videos, and other files. It is a similar story for your PHP memory limit. PHP memory limit helps you run plugins and scripts. If you run a website full of content sometime this could be a big problem when php limits exhausted. You may receive “Fatal error: Allowed memory size of 12345678 bytes exhausted” error.

In this article, we will show you how to increase the maximum file upload size in wordPress and increase php memory limit.

Theme Functions File:

There are cases where we have seen that just by adding the following code in the theme function file, you can increase the upload size in wordpress:

@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );
@ini_set( 'WP_MEMORY_LIMIT', '96M' );

PHP.ini File:
In case of shared host you will not see php.ini file. Create php.ini file and add following code. Upload it in the root folder of the website

upload_max_filesize = 100M
post_max_size = 200M
memory_limit = 300M
file_uploads = On
max_execution_time = 180

htaccess File:
You have another option for increasing uploading size and increasing memory limit through htaccess file. Add following code in your htaccess file and upload root folder of the website.

php_value upload_max_filesize 64M
php_value post_max_size 200M
php_value memory_limit 300M
php_value max_execution_time 180
php_value max_input_time 180

wp-config.php File:
Try to editing wp-config file of the wordpress add the following to the very top of the file and save the file.

define( 'upload_max_size' , '64M' );
define( 'post_max_size', '64M');
define( 'max_execution_time', '300' );
define( 'WP_MEMORY_LIMIT', '96M' );

Add google reCaptacha to contact form 7

Hi friends, Google has an improved, user-friendly Captcha system. In Which it asked for checked a checkbox  for confirming “I’m not robot”. In WordPress, Contact Form 7 is the most popular plugin for creating contact form. Latest version of Contact Form 7 provide best way for antispam protection.

In this tutorial, I’m going show you how to integrate reCaptcha to Contact Form 7 in your WordPress Website.

Step 1. Install the Contact Form 7 plugin

  • Login to your WordPress site.
  • Go to Plugins > Add new and search for “Contact Form 7”.
  • Click “Install Now” and activate the plugin.

Step 2. Create reCaptcha public and secret keys


Step 3. Integrate reCaptcha with Contact Form 7

  • Go to the admin menu Contact > Integration.
  • Find reCAPTCHA panel and click Configure Keys.
  • Copy the site key and secret key into the fields and save them.

Step 4. Embed the reCaptcha shortcode into contact form

  • Go to Contact > Contact forms > Your form.
  • Paste below shortcode into form box to render the reCaptcha field.

End Result


Difference between MySQL and MySQLi

Basically there is no major difference between Mysql and Mysqli. Mysqli is nothing but an improved extension of Mysql.

MySQLi: – The i stands for Improved. The MySQLi extension is designed to work with MySQL version 4.1 or newer. MySQLi introduced with PHP 5.0 and MySQLi takes advantage of the newer features of MySQL 5.

Features :

  • Support for Prepared Statements
  • Object-oriented interface
  • Support for Transactions
  • Support for Multiple Statements
  • Enhanced debugging capabilities
  • Embedded server support

Connectivity in our project:
To create a connection just instantiating a new instance of MySQLi and using a username with a password connecting to the database, as follow:

$db = new mysqli('servername', 'username', 'password', 'databasename');

if($db->connect_errno > 0){
die('Unable to connect to database [' . $db->connect_error . ']');

Where $db is object for connection mysqli queries. Some various query examples are:

Select Query:

$sql = "SELECT * FROM `tablename` order by id DESC";
$result = $db->mysqli_query($sql);
while($row = $result->mysqli_fetch_array())
echo $row['name'];

Delete Query

$sql="delete from tablename where eID='$eID'";

Another Way of writing mysqli query
You can write mysql query without object pointing. See below

Select Query:

$sql = "SELECT * FROM `tablename` order by id DESC";
$result = mysqli_query($db,$sql);
while($row = mysqli_fetch_array($result,MYSQLI_ASSOC))
echo $row['name'];

Delete Query

$sql="delete from tablename where eID='$eID'";

Use of databse object inside member function of a class
I am creating a function for deleting rows. You can use $db object inside a member function by defining as global.

See below example:

function deleteBlock($eID)
 global $db;
 $sql="delete from tablename where eID='$eID'";

Use same as other queries of mysql.