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

print drupal 7 db_select() query

This how you can can print the query with parameters generated by db_select() . print strtr((string) $query, $query->arguments()); die; //Stop execution here and show me the query make sure you print it befo...

Add region/state of the country in magento

Sometime we need to have dropdown for states related to countries just as we have for United States by default, for that we need to add states of particular country. To add custom states we need to modify the tables of magento. There are two tabl...

how to upload & save images into database In CakePHP

In this post, I am gonna give an example to upload Images and store its file path in the database with the help of custom component. Example: Add this UploadComponent class in app/controller/component folder. <?php class Upload...

How to Work With mkdir() function in PHP ?

The mkdir() function is basically use for making a directory. Syntax of mkdir() function mkdir("dir_name"); You can see below example of mkdir() function. <?php // here call mkdir() mkdir("testdocs"); ?> In the above ...

Install new language package in magento

To create a multilingual ecommerce website we need to add language packages. So I am explaining how to add language pack in magento. We can install the language packs by following these steps - 1) Go to magentocommerce website and search the ...

What is rand() function in php?

The rand() function is used to generate a random integer number. How to use rand() function? Syntax of rand() function:rand(); or rand(min,max); min:- min is use for Specifieing the lowest number that is retuned. Default min is 0. max:-m...

Access to Auth Componenet using session in CakePhp

To access the Auth component from view will give you error like you cant access the Auth component. Here is a way of accessing the Auth components from view which can be done using CakeSession in cakephp. to do so lets see the example : ...

How to use $_Get in php?

PHP $_GET can also be used to collect form data after submitting an HTML form with method="get". $_GET can also collect data sent in the URL. You can see below example of $_Get in php. <!DOCTYPE html> <html> <body> ...

How to upload a file in php ?

When you want to upload your curriculum vitae, Your Profile picture, on the server then you can use File uploading method in PHP. With php concept you can easily upload your resume and any other document. There are tow important propert...

upload file using CURL?

As we know that CURL is a library that allow us to make requests(HTTP requests) in PHP. We can upload a file as well using CURL. For upload a file using CURL must follow below points : Uploading file size is mandatory to be less than f...

How to calculate number of days between two given date's in PHP

Hello Reader's! If you need to calculate the number of hours or days between two given dates then PHP offers you a lot of ways. But you can perform this task by the following way: Lets see the example below:- //Calculate number of hours betw...

How to get the colomn name of table using MySql

Hello Reader's, If you have to get the only names of columns of table then see the code below:- You can use following query for MYSQL:- SHOW columns FROM your-table; Below is the example code which shows How to implement above syntax in ph...

How to check if uploading file is in .csv extension using PHP

Hello Reader!, If you are looking for verify the uploading file with the correct extension with .csv only. Then you use the PHP code as below:- $allowed = array('csv'); //you can mentions all the allowed file format you need to accept, like ...

Object Iteration?

In PHP we can iterate any object by using the list of items,for getting list of items we have foreach loop in php. So that there will only the visible properties is being listed. We have loops concept for iterating throughout data list in php....

How to apply layout in CakePHP ?

In CakePHP, there is by default layout in (app/View/Layouts/default.ctp) file, But there are many cases in which we can apply different layout in pages as per our client requirement. Case- 1 If we dont want any layout for our controller metho...

How to use $_POST in php.?

$_POST is basically used to accumulate form data after submitting an HTML form . $_POST is submit data with method="post". $_POST is also widely used to pass variables. You can see below example of $_POST. <!DOCTYPE html> <html&...

trim() string function in php

trim is a function in php which removes the whitespaces from the beginning and end of a string. but if we want to remove them from one side specifically then we will use these trim function for the left side trim ltrim() and for the right side t...

What is difference between session_unset() and session_destroy() in PHP -

The functioning part both the syntax will work the same but by inditing session_unset will clears the $_SESSION variable but will not ravage the variables and it will initialize to this stage: session_unset(); effaces only the variables from s...

Set Cron in Zend Framework?

In order to set cron in zend framework please follow the below steps. Step 1: Please do not execute or access the bootstrap's run function directly in the file index.php Location of file : public_html/index.php Now Upgrade below code:...

How to configure Database in CakePHP

CakePHP database configuration details are in a file that is located at app/Config/database.php. the database file. You can edit the file in the notepad or sublime and can edit the feilds by which it will be connected to the database. Here w...

Query for multiple fields with Laravel 4.x

I have a situation where we have to make query for searching on the basis of multiple fields with Laravel 4.x. So for this we have many method either we will concatenate or we will use OR query in Laravel Example: $searchqueryResult =User:...

Arrays in php

Arrays are the sequential memory storage which holds the different elements of same type under a common name. The arrays have key/value pair in which the key points to the value. There are two types of arrays: Indexed array and Asso...

Name, Email & Url Validation in PHP

User Name Validation Code: Use below code, to check if the name field only contains alphabet and white space. $name = test_input($_POST["name"]); if (!preg_match("/^[a-zA-Z ]*$/",$name)) { $nameErr = "Only alphabet and white space allowed"...

How do I get a YouTube video thumbnail from the YouTube API?

Hello Readers! We can use YouTube Data API to retrieve video thumbnails, caption, description, rating, statistics and more. API version 3 requires a key*. Obtain the key and create a videos: list request. Example PHP Code $data = file_ge...

How to remove duplicate values from a multi-dimensional array in PHP?

The array_unique() function removes duplicate values from an array. If two or more array values are the same, the first appearance will be kept and the other will be removed. Example : <?php $a=array("a"=>"red","b"=>"green","c"=&...

Comparison of PHP equality (== double equals) and identity (=== triple equals)

Hello Readers ! == compares the values of variables for equality, type casting as necessary. === checks if the two variables are of the same type AND have the same value. Examples: 1 === 1: true 1 == 1: true 1 === "1": false // 1 is an...

How to use ucfirst() function in php ?

What is use of ucfirst() in php ? The ucfirst() function is used for converting the first character of a string to uppercase. Syntax of ucfirst() function: ucfirst(string) string is a parameter that is compulsory to given for convert...

PHP change the maximum upload file size

Option 1 : You need to set the value of upload_max_filesize and post_max_size in your php.ini : ; Maximum allowed size for uploaded files. upload_max_filesize = 40M ; Must be greater than or equal to upload_max_filesize post_max_size ...

What is superglobals Variables in php. ?

There are many predefined variables in PHP which are "superglobals", that denotes they are always accessible, regardless of scope. and you can access them according to your need from any function. So, there are 5 main superglobal variables i...

Errors in PHP

Errors are the unwanted conditions which interrupts the normal flow of the program. Errors can be categorized in two : Syntax Error : If there is any symbol missing or mistake in the statements of the program those are syntax errors. Log...

Authenticate Application In CakePHP Using Auth Component

In CakePHP,"Auth" component provides Login functionality to authenticate a user. You just Follow the below Steps to develop authenticate application in CakePHP. Step-1. To Use 'Auth' in AppController, you have to create $components array ...

How to use of strtoupper() function in php.?

What is use of strtoupper() in php ? The strtoupper() function is used for converting a string to uppercase. Syntax of strtoupper() function:strtoupper(string) string is a compulsory parameter You can see below example of ucfirst() ...

How to use session in php. ?

Firstly let us know what is session ? Session variables hold information about one single user, and provide to all pages information in one application. So, session basicallu store informatiom in a variable and provine in multiple page for a ...

Redirection through htaccess file

.htaccess is the most useful file when we are working with php and apache. The directory level configuration of Apache server software is provided via .htaccess (Hypertext access) files. htaccess files defines mostly all the things like server se...

md5 function in PHP

The md5 function in PHP is used to hash or encrypt a string by calculating the md5 . The syntax is: md5 ('string', raw) The string here is passed to encrypt the string and the raw is an optional field,which is the format of output.It ...

How to use of join() function in php.?

What is use of join() function.? The join() function returns a string from the elements of an array. The join() function alias of implode() function. Syntax of strtolower() function: join(" ",array) You can see below example of join()...

URL rewriting with PHP using .htaccess

Hello Readers! If you have this URL like : url.com/picture.php?id=51 and you want to make like this : picture.php/Some-text-goes-here/51 . In this case it can be done by using htaccess. Add a file called .htaccess in your root folder...

How to use of strtolower() function in php.?

What is use of strtolower() in php ? The strtolower() function is used for converting a string to lowercase. Syntax of strtolower() function:strtolower(string) string is a compulsory parameter You can see below example of ucfirst() f...

Send email using the GMail SMTP server from a PHP page

Hello Readers! You people can use below code if you are using Gmail SMTP connection. $from = '<fromaddres@gmail.com>'; $to = '<toaddress@yahoo.com>'; $subject = 'Hi!'; $body = "Hi, How are you?"; $headers = array( 'Fr...

What is use of ucwords() function in php.?

Definition of ucwords() function This function is used for converting the first character of each word in a string to uppercase. Syntax of ucwords() function:ucwords(string) string is compulsory paramere You can see below example of...

How to expire a PHP session after 30 minutes?

Setting the session creation time (or an expiry time) when it is registered, and then checking that on each page load could handle that. Example: $_SESSION['example'] = array('foo' => 'bar', 'registered' => time()); if ((time() - $...

How to parse and process HTML in PHP?

Hello Readers! If you want to parse any HTML page then you would you "Simple HTML DOM Parser". How to get HTML elements: Create DOM from URL or file $html = file_get_html('http://www.example.com/'); Find all images foreach($ht...

How to fix Headers already sent error in PHP

Hello Readers! You all got this error many times before and I am sure all PHP programmer at-least once got this error. To solve this error you can solve use solution as per your problem level: Possible Solution 1: You may have left blank...

Wordpress hook wp_register_script

Hello Readers, Description Description Registers is a script file on WordPress, and is supposed to be linked to a website later with all the wp_enqueue_script() function, which usually safely manages this script dependencies. Scripts t...

Binary Search Tree in PHP?

Binary Search Tree is also known as a ordered or sorted binary tree which is a node-based binary data structure . Binary Search Tree has the following properties. The left side subtree of a node should always contains only the nodes with...

How to use filter_var() function in php.?

What is use of filter_var() function. ? The filter_var() function filters a variable with the specified filter. Syntax of filter_var() functionfilter_var(var, filtername, options) You can see below example of array_rand() function in php...

How to use array_rand() function php.?

What does array_rand() function in php.? The array_rand() function returns a random key from an array, or it returns an array of random keys if you specify that the function should return more than one key. Syntax of array_rand() function:a...

Please stop using the action hook wp_print_scripts to load JavaScript

Hello Readers, This plugin is using the wp_print_styles and wp_print_scripts action hooks to load all css and javascript. wp_print_scripts shootes with just about every page heap that can cause your javascript for you to heap everywhere whic...

Replace default WordPress jQuery script from Google Library

Hello Readers, There are default scripts that is included with each WordPress installation. These types of scripts have reached disposal regarding style as well as plugin experts to make use of of their function. Via our experience, jQuery is ...

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...
1 27 44
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: