Sunday, 21 December 2014

Tuesday, 9 December 2014

Increase Media file upload size in Wordpress Multisite

In WordPress, Maximum upload file size will not change even when changed in the php.ini file.
Here are the steps to change the Maximum upload file size within WP admin:
1. At the top, hover over My Sites and then click Network Admin
2. At the left, hover over Settings and then click Network Settings.
3. Scroll to the bottom of the page and change the Max upload file size to whatever you would like in KB.
4. Click Save Changes.

To get Free assistance and any Query related to Wordpress, html ,css and responsive websites ....




Wednesday, 3 December 2014

PDO (PHP Data Object)

PDO(PHP Data Object)  : PDO is a PHP extension for accessing databases in PHP.

Advantages:
1) Security : In MYSQL connection we manually sanitise using mysql_real_escape_string() functions in order to avoid SQL injections. But with PDO this is all taken care for us and means we no longer have to worry about SQL injection.
2) Performance : PDO uses PHP 5′s OOP characteristics (Object Oriented Programming) so it is working with classes and objects. PDO is written in C and compiled into PHP providing a performance increase over solutions written in PHP.
3) PDO provides single interface across multiple databases. That means to easily migrate to a different database engine (SQLite, Oracle, MSSQL, ODBC, etc.)
4) We can use error handling in PDO by using try, catch and throw.

Connection Syntex:
$user = USER_NAME;
$pass = PASSWORD;
 $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);

 Exception handling in PDO:
  try {
    $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
  }
  catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
 }

 Prepare query:

 Insert query:

 $sth = $dbh->prepare("INSERT INTO `table` (`id`, `title`) VALUES (:id, :title)");
 $sth->execute(array(':id'    => 123,':title' => 'I am the title'));

 Select Query:

 $sth = $dbh->prepare("SELECT `id`, `title` FROM `table` WHERE `id` > :country_id");
 $sth->execute(array(
    ':country_id' => 200
 ));
 $count = $sth->rowCount();