Php tutorials


PHP Global variables:

Get & Post methods:

data can be sent to Body no one can see the data. (secure and mostly used).


$_POST[]: both post and get variables extracts the form fields into variables and values

$_GET[]:   used send data via URL or http header. (security issues anyone can see the data)

$_REQUEST[]: it accepts both get and post method in form fields.

<form method=”POST” action=”action.php” name=return false validate()/>

Name: input type=”text” name=”name”/>

email: input type=”text” name=”email”/>

Mobile: Input type=”text” name=”mobile” />

Password: input tyepe=”text” name=”password”/>

<input type=”submit” value=”display text” />


in the above Name values (name,email,mobile,passwords)  treats as Variables. and user entered inputs are treats as values.

this can be extracted by extract(S_Post[form])

Onclick form we hae set return false to validate details by cilentside scripts like js,jquery etc


server-side validation:


isset(): to know it contains value or not

empty() to check variable null or not.


Query strings:  also known as “?”, using this we can pass keys and values via URL.  using get method.





Connecting database 


$dbconnection= Mysqli_connect(“localhost or remote”,”dbuser”,”password or empty”, “databasename”)

// Checking connection
if (!dbconnection) {
die(“Notconnect ” . mysqli_connect_error());  //here conactinating stings with mysql error fucntion to display errors.



  • Warning: mysqli_select_db() expects exactly 2 parameters, 1 given

Error mysqli_select_db() should have 2 parameters, the connection link and the database name

mysqli_select_db($dbconnection, ‘databaename‘) or die(mysqli_error($con));


  • error :Warning: mysqli_query() expects at least 2 parameters, 1 given

$query = mysqli_query($dbconnection, “SQL query“);



Mysqli vs MySQL_connect


mysqli is improved version of MySQL available from PHP 7. MySQL extension works up to PHP 5.6.


INSET query:

“Inset into table name (column1, column2, column3,) values (val1, val2, val3)”;



Associative array:  in the form keys and value

ex: $form = array(“name”=>”alebert”, “email”=>””, “mobile”=>”000000000”);

Index array:  $values = array(“1”, “2”, “3”);

$values[0] = “1”;
$values[1] = “2”;
$values[2] = “3”;

Multidimensional array: 



WordPress & Php 7 compatibility and issues

Please Upgrade php5.6 to PHP 7.1 which uses less ram and faster performance.

RAM consume different 40MB with PHP 5.6 and php7.xx using 4-10GB ram hard. all themes and WordPress core also compatible with PHP 7 upgrade and save resources billing. also, give better speed for the user.


diffrence among =, ===, and ===.

x = 1 //x now equals 1
true == 1 //does the boolean value of true equal 1? (True) //not strict
true === 1 //does the boolean value of true equal 1? (False) //strict