Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

How to add Captcha with CakePHP

We can add captcha for blocking spams robots accessing our site or application. We can add captcha in our web application and website by using the below code -> <?php App::uses('AppController', 'Controller'); class PagesController exte...

How to use array_keys() function php.?

What does array_keys() function in php.? The array_keys() function returns an array containing the keys. Syntax of array_keys() function: array_keys(array,value,strict) So, there are three main Parameter of array_keys(). These are foll...

Prevent SQL-injection in PHP

User can prevent SQL- injection in php by using given 3 ways. Method1. By Using PHP inbuilt Functions. $name = mysql_real_escape_string($_POST["name"]); mysql_query("INSERT INTO users VALUES($name)"); Method 2. By Using MySqli instead...

Save MySQL query results into a text or CSV file

Hello Readers! MySQL provides an easy mechanism for writing the results of a select statement into a text file on the server. Given a query such as SELECT order_id,product_name,qty FROM orders which returns three columns of data, t...

Importing a csv into mysql via command line

Hello Readers! MySQL have this load data function, where we can insert data to a table from external files like csv, txt etc. The process is quite simple, 1st lets login to mysql via terminal/console. mysql -u root -p Enters usernam...

Upload CSV and Insert into Database Using PHP/MYSQL

Hello Readers ! We can simply upload upload CSV data into database by two simple ways. Step 1 Data Base Connection <?php $db = mysq_connect("Database", "username", "password") or die("Could not connect."); if(!$db) die("n...

How to use array_flip() function php.?

Why use array_flip() function in php.? The array_flip() function mainly used for exchanging all keys with their associated values in an array. Syntax of array_flip() function: array_flip(array) You can take reference form below examp...

String Function In PHP

String function in php To reverse a string strrev- It is used to reverse a string. <?php echo strrev("Hello world!"); // outputs !dlrow olleH ?> To search for a specific text in your string strpos- it return the characte...

How to use array_fill() function php.?

Use of array_fill() function in php. The array_fill() function is basically used for filling an array with values. Syntax of array_fill() function: array_fill(index,number,value) According to above syntax, there are three main Param...

How to use substr() function php ?

Definition of substr() function in php ? The mainly use of The substr() function returns a component of a string. Syntax of substr() function substr(string,start,length) You can see below example the use of substr() function. &l...

How to create custom taxonomy for post type page

Hello readers, today we will discuss "how you can add category for post type page". When a user install the WordPress, user will only get category for "post type post". If user want to add taxonomy or category for "post type page", then u...

How to use define() function php ?

What is define() function ? The define() function basically use for creating a constant. It depends on 3 parameters: 1-name-> this is the name of the constant. 2-value->value of the constant. 3-case_insensitive-> define co...

find and save the records by using cakePHP models

make a controller name Pagescontroller.php and paste the following below code <?php class PagesController extends AppController { public $name = 'Pages'; /* Use Customer model */ public $uses = array('Customer'); ...

How to use compact() Function in php ?

What is compact() Function ? compact() Function is used for creating an array from variables and their values. Syntax compact() Function: compact(variable1,variable1,variable3....) Note:If any strings that does not match variable name...

How to save data in CakePHP

This is a very simple application in cake php for saving the data into database. We can simple make it by making the database and connecting it to cake php. After making the database and tables we can use this code for saving the data input in...

How to handle default error in PHP

We can handle default error in PHP in a very simple way. This can be done by sending an error message with its filename, error line number and a message that describes the error to the browser. Error handling plays an important role whenever we ...

How to use current() function and end() function in php ?

why use current() function: current() returns the value of the current element in an array: Syntax of current() function: current(array) why use end() function: end() returns the value of the last element in an array: Syntax of...

How to use each() function in php ?

What is the work of each() function ? PHP each() function mainly Return the current key and value pair from an array. Syntax of each() function: each(array_name) You can take reference form below example to use of each() function. ...

How to use strrev() function in Php?

What is the strrev() function? strrev() function is uses for reversing a string. strrev() function is also used for reversing a number. In the given below example you can easily understand the use of strrev() function <?php //here c...

How to use list() function in php ?

What is the use of list() function? The list() function is used to assign values to a list of variables in one operation. list() function basically works on numerical arrays. Syntax of list() function:- list(variable1,variable2,variable3...

How to use md5() function in php ?

What is utilization of md5() function ? MD5 stand to Message-Digest Algorithm, and MD5 is widely utilized in security-cognate applications. It Calculates the MD5 hash of str utilizing the RSA Data Security, and returns that hash. So, b...

CakePHP built-in sessions

CakePHP have several In-built sessions configurations. We can use these sessions as the basis or can create a fully custom solution for that. To use defaults inbuilt sessions, we can simply set the defaults key to the name and can override any s...

PHP $_SERVER superglobal variables.

$_SERVER is a PHP super global variable which holds information about headers, paths, and script locations. The example below shows how to use some of the elements in $_SERVER. <?php echo $_SERVER['PHP_SELF']; echo "<br>"; echo ...

Facebook SDK for PHP

Hello Readers , The following code demonstrate how you would accomplish common tasks with the Facebook SDK for PHP. This SDK can be use in facebook login , Retrieve a user's profile , Post a link to a user's feed. window.fbAsyncInit =...

How to use str_replace () function in php ?

What is utilization of str_replace () function ? there are 3 main uses of str_replace () function in php. 1-str_replace() function supersedes some characters with some other characters in a string. 2-str_replace() Supersede all occurren...

How to use strpos() function in php ?

What is the strpos() function ? The strpos() function searches for a concrete text within a string. In other word we can say that strpos() function use for searching position of Text Within a String. If text word match will found, th...

How to use user defined function in PHP ?

Firstly let us know What is the user defined function in php ? This function declaration starts with the word "function" and user defined function name is not case-sensitive. User defined function starts with a letter not a number. Use...

How to use arsort() function in php ?

What is tht arsort() function in php ? The arsort() function sorts an associative array in descending order, as reported by the value. why use arsort() function in php ? arsort() is fundamentally used when sorting associative array in ...

How to use asort() function in php ?

What is tht asort() function in php ? The asort() function sorts an associative array in ascending order as reported by the value. why use asort() function in php ? asort() is fundamentally used when sorting associative array where the...

How to use implode() function in php ?

What is tht implode() function in php ? The implode() function basically utilized to join elements of an array with a string. So in other word we can say, it takes an array and returns a string. syntax of implode() function implode (sep...

How to use rsort() function in php ?

Let us know What is tht rsort() function in php ? The rsort() function sorts array in decending order menas highest to lowest. why use rsort() function in php ? rsort() function basically used for sorting the elements of the array in d...

How to create Cookies With PHP

Why we create cookies ? cookie is used to identify any user. A cookie is known as a very small file that the server copy into the user's computer browser. Whenever users request a web page using the same computer , it will send the cookie too....

How to use sort() function in php ?

What is tht sort() function in php ? The sort() function sorts an indexed array in ascending order means lowest to highest . why use sort() function in php ? Sort() function basically use for sort the elements of the array in ascending...

How to use explode() function in php ?

Firstly let us know why we use explode() function in php ? explode() function basically used for breaking a string into an array in php. explode() function is binary-safe in php. explode() function syntex is given bellow: explode(','...

Two dimensional Array sorting

Here we will learn how we can sort two dimensional array:- lets take an example :- <?php $activities = array ( '1' => array( 'id' => 1, 'time' => "2015-10-22 14:20:00" ), '2' => array( ...

How to utilize array_values() Function in php ?

why we use array_values() function in php ? The array_values() function use for returns an array which have all the values of an array. you can see below example: <?php //firstly create a array of a city detail $Citydetail=array(...

How to use time() Function in php ?

What is use of time() Function in php ? Php time() function basically use for returns a current unix timestamp. In which, you can utilize the date() function to format it to your desiderata. You can see below example of time() function...

How to use addslashes() functionin php ?

What is addslashes() function ? The addslashes() function basically used to returns a string with backslashes before characters that need to be quoted in database queries. Mostly it is used for predefined characters, addslashes() function i...

How to add custom field in wordpress for category

Hello Reader's! if you are new to wordpress development and need to add more custom fields in category, Then you can learn it from the code below:- Step:1- Open the file functinon.php and add the following code in it. add_action( 'category...

How to use wordwrap() Function in php ?

What is wordwrap() Function in php ? wordwrap() Function wrap a string into incipient lines when it reaches a concrete length. So,basicaly use of wordwrap() wraps a string into new lines. wordwrap() include space also. You can take re...

How To Install Plugins in Cake PHP

There are four ways to install a plugin in CakePHP-> Plugin install through Composer Manually plugin install Plugin installed As Git Submodule By Git Cloning 1- Manually To install a plugin manually in CakePHP, you just have to m...

How to use trim() Function in php ?

Why we use trim() Function in php ? The trim() function mainly use for removes the spaces from the beginning and the end of the string. trim() function will divest and control characters such as : " " an ordinary space. "\t" a t...

How to use of "ksort" in php

Firstly we will know what is the use of "ksort" in php "ksort" is used to sort the array by key and this is useful for associative arrays. You can see below example for "ksort". <?php //suppose we want sort employee age from ...

How to utilize use of count() function in php

what is count() function The count() is utilize to count all data elements in an array, or in other word we can say The count() function returns the number of elements in an array. You can see below example of count() function. ...

How to use array_search() Function in php

what is array search ? Array search returns the corresponding key if search is successful and Searches the array for a given value. You can take reference form below example. <?php //firstly create a array $employeName=array("1"...

How to fetch data from array using php ?

You can take reference form below example to fetch data from array list using php. This method is really very easy. <?php // you have to Decode the array and store a variable $GetRecord = json_decode('[{"Name":"Mac","age":"25"},{"Na...

How to make custom logo in admin of Wordpress

Hello Reader's! If you are new to wordpress and need to set your own logo from admin then you can use the wordpress custom logo management in the code:- First create of open the file, Functions.php in the root directory. now paste the code ...

Static method in PHP

When we declare a function as static then we generally get confused about what to use like '->', '::', 'this' or 'self'. There are something we need to take care of when declaring a function as static: 1: If the variable or method being...

How to check if cookie is enable or not

Hi. If you are looking for code to alert user if his cookies are enable or not, Then look the code as below:- paste the code in you file <?php if (isset($_COOKIE['cookieCheck'])) { echo 'Your cookie is Enable'; } else { if ...

Data Validation in Cake PHP

Data validation becomes an important part of any of the application. It helps to make it sure that the data input by the user is proper or not. Defining the validation rules in any application makes the form handling easier. Validation differs ...
1 9 14
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: