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

How to import large .sql file to mysql via terminal

If you want to import large sql file to mysql via terminal, here are the steps: First go to terminal, for Linux (UBNTU) user can go directly by pressing Ctrl-Alt-t key. Now write down the following commands in Terminal. mysql -u <userna...

Creating Web Services with PHP and SOAP

What is SOAP?? SOAP stands for Simple Object Access Protocol. SOAP uses HTTP request for intraction between programs. Because of HTTP request is supported by all servers and browsers, that's why it is a best way to communicate between applicat...

Create Update, Delete and Insert Functions

Hello, Here I am writing the code to create update, insert and delete functions so that we can use it the same functions anywhere in the project. <?php // function to insert data function insert($table = "", $fieldsArray = array()) {...

Logger class in PHP

Hi This is a simple application logging class which you can use in your PHP project. It currently provides two methods, one for logging messages and another to log a dump with an optional message. I will add the streams support and stack tra...

How to optimize and repair all databases and tabels in mysql?

Optimization of database tables in mysql is a methodology which must be done frequently to make your database healthy. As per mysql manual, OPTIMIZE TABLE should be used if you have deleted a large part of a table or if you have made ...

How to import csv file into mysql database in php

To Import csv file into mysql database using php script follow the below code: For example: I have a .csv file data with this formate:- (1) Indresh Singh, indresh@abc.com, 12345 (2) mukul kant, mukul.kant@abc.com, 12345 To insert ...

How to Make Database Association on Selected Pages In Cakephp

If you want to make Database Association on Selected Pages In Cakephp follow the below steps, Below code can set association where it require and you can also reduce unnecessary queries firing to database. Make function in your model and ...

Install Image Magick on linux CentOS

We can easily install image magick on linux centos by following the below given steps : $ yum install make $ yum install gcc $ yum install php php-fpm php-devel php-pear $ yum install ImageMagick ImageMagick-devel $ pecl install imagick $...

Paypal: Create Recurring Payments Profile Working Code

This code use to deduct amount automatically from paypal buyers account. It is something like advance payment mode. If user agree with automatically deduction when he / she paying through paypal then amount will deduct according to billing period...

Remove .php, .html,.htm extension from website url.

Hello , I am sharing here how you can remove .php extension from Url of your website. here are the following steps:- Create a .htaccess file in project directory. Suppose you have to remove the .php extension from a PHP file for example ...

SMTP Configuration of server

If you are using some other server like godaddy or some other server for that you need to put the settings of that particular server in its setting. I am sharing the settings for godaddy server. $mail = new PHPMailer(); $mail->IsSM...

How to download file using PHP script

We use this script to download a file from a given define file path location In this script we are using two variable: 1:) $fileName // for file name with path. 2:)$title //for file name changed in you given title name. <?...

How to integrate MobBill Mobile payments for Video, Ringtones etc

Hi All, Here I am sharing how to implement MobBill Mobile payments, for this follow the steps below :- Step 1 -> You need to login into the link http://merchant.mobbill.com/insight/login/auth and create your account. Step 2 -> Now...

Create custom component in Joomla 1.5

Sometimes, when we are working on CMS like Joomla, Drupal etc, we have such requirements for which we need to build our own component. On that component, we can add our logics for development. Here are some basic steps to create you own Joomla...

Steps to create custom plugin in Joomla 1.5

There are some core plugins availabe in Joomla project for e.g. System, User, Search, authentication, content etc. Plugins provide a function which are associated with specific event trigger. In one of my project, I had a requirement to add pa...

Creating CSV from HTML using jQuery

In one of the project, I needed to create the CSV file from the html using jQuery. To make this possible, I created the below code to convert the html into csv file using jQuery. <script type="text/javascript" src="jquery.min.js"><...

How to Create Simple Html File Through PHP Script

This tutorial show's how we can create a simple Html file through PHP script. if($filename == ''){ $filename = 'demo.html'; $writefile = ($filename , 'w'); $content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict...

How to Make a new CSV File Through PHP Script.

This tutorial show's how to create a new CSV file through PHP script. This script is more helpful for php developer to create a new CSV file in array formate. function functionname (parameter) { if (($handle = fopen("$data", "r")) !== ...

Code to validate ISBN10 or ISBN13

We seldom need a code to check whether the ISBN of book we are trying to search is a valid ISBN or not. So as to validate a provided ISBN we can use the below code for ISBN10 and ISBN13 respectively : Code for checking validity of ISBN10 : ...

Unexpected bheaviour of in_array in PHP

We have an associative array where its values are all Boolean and if we search for a string, we got true. Lets see an example. <?php $array = array( 'count' => 1, 'references' => 0, 'ghosts' => 1 ); var&#95;dump...

Laravel Framework

Recently Laravel framework has been launched in the market as I am not familiar with it, because still I have not worked on this framework but it seems to be one of the best MVC framework, below link provides you an average of mostly used/popular...

Passing extra data with push notification

Sometime we do need to send additional data while sending Push-notification on iPhone , this can be easily achieved by adding following line to your code. But one should keep in mind that apple does have a limitation of 144 character while sendin...

How to connect to your MySQL database from a PHP Script

Create simple Mysql connection with the help of PHP code <?php $hostname = 'localhost'; //define the hostname here $username = 'root'; //define the username here $password = ' '; ...

Flaws of "and" and "or" operators in PHP

Today, When I was doing some programming stuffs and I found out that there is serious flaw in the and , or logical operator of PHP. Im not talking about the symbol || and && logical operator. Im talking about the and and or logical op...

Solution for error 'The requested address '/' was not found on this server' in cake PHP

If anyone face the error 'The requested address '/' was not found on this server' in cakePHP, then try these two steps:- Add function date_default_timezone_set() somewhere in you cake/app folder. If above solution not works then place date_...

Using Email or Username to login with auth in cakephp

We seldom need to login into application using Email or Username while using Auth with Cakephp. To achieve this we either need to write customized Auth component or we can achieve the same with the following code : public function validateUs...

Form submit in javascript

I would like to share an interesting feature that I found as I was trying to submit form through JavaScript. If you are trying to "form.submit()" through javascript and any form elements present with the name of "submit" in it, then in that case...

Time Difference between two timezones - Php

Many a times we need to take out time difference between two time zone using Date class in php. We can use the following code :- $timeZone = ['Any Timezone']; $default = date("Y-m-d h:i:s A");// UTC $dateTimeZone =...

How to download any CSV file while working with PHP

/* Header file to includes. fopen is use to open a file in write mode here. fputcsv function is use to output the CSV file having the name of columns and data coming from database. */ header('Content-Type: text/csv; charset=utf-8'); header('...

Date difference between two timezones in PHP

Here is a short function to get the difference between two timezones in PHP:- function diff(){ $date1 = "2014-02-27T20:00:00+04:00"; $date2 = "2014-02-28T07:20:00+08:00"; $diff = abs(strtotime($date2) - strtotime($date1));...

Get timezone from address or zipcode or address

Hi, We can get user's timezone if we have only address or zipcode of that user. First of all we need to get latitude and longitude then using these lat and long we can get timezone. However this is 2 step approach but it is much accurate becau...

How to create profile page hiding controller and action name in yii

How to create profile page hiding controller and action name in yii In url manager add this line '<username:\w+>'=>'site/index', username will be the parameter for name or id and site is controller name and the url will be...

Image Rotation by image magic

Creating image rotation using Image magic by command line. Some time image taken from iphone when uploaded on the website gets rotated .We can easily find that the image is rotated and can rotate is back by using the following code. $rot...

Bind Model in cakephp

In one of my project I have two table with simple relation Division (id, title) - hasMany Staff Staff (id, division&#95;id, name, jobtitle) So. Now I need to get some info like: I need to get all Staff where birthday today, and get r...

Get the title and meta tags from a url in php

To get the title and meta tags from a website you can use the following code : <html> <head> </head> <body> <?php function getTitle($Url){ $str = file&#95;get&#95;contents($Url); if(str...

Scrapping - get Select option values and text via simple html dom

Here is the working example to get select box option value and text via Simple html dom. I assume that you have already included simple_html_dom file and have html content in $content variable $html = new simple_html_dom(); // Creating htm...

What Is The Diffrence Between Do And Do While Loop

The Main Difference Between Do And Do While Loop Is :- Do while Loop :- If we use "Do While" at least one time execute the loop and then check the Condition. While Loop:- When we Use "While" then firstly check the condition after execute ...

Snapshot of any website from its URL

Get the snapshot of any website in php without writting a script <html> <head> <!--[if IE]> <style> #frame { zoom: 0.2; } </style> <![endif]--> </head> <body> <div class="test...

Getting the Code of any site using php script

Open the code view of any site : <?php $lines = file('http://www.whoznext.com/'); //Site url foreach ($lines as $line&#95;num => $line) { // iterate through each line echo "Line #{$line&#95;num} : " . htmlspecialchars($line...

How to inherit the properties and methods of base class to the child class in php

<?php class data<br> {<br> public $firstno;<br> public $secondno;<br> public function getData($fno,$sno)<br> {<br> $this->firstno=$fno;<br> $t...

Passing an array to the URL

Sometime you may need to pass the array in the url. You can do this as following: <?php $array["a"] = "A"; $array["b"] = "B"; $array["c"] = "C"; $array["d"] = "D"; $str = serialize($array); $strenc = urlencode($str); print $str ....

How to make UL/LI tree from a normal array

We usally wants to male a ul/li tree from an array having parent id within each individual record : $subjecttopic=Array ( [0] => Array ( [id] => 52b28146f484a5a410000029 [name] => Addtion ...

Using Ternary operator instead of If/Else in Php

Evaluating If Else statements is very common in programming paradigm. But 'If Else' statements are long and they can be easily replaced by simply using Ternary operators. Here is a tutorial on the usage of ternary operators and their implementati...

Extract method in PHP

Sometime we may need to use the same variable name that you are using in the query or simply in an associative array. Lets say you have an associative array : $arr = array( 'totalLimit' => 50, 'limit' => 10 ); The usually what we...

Using HeroDocs in php

Herodocs are useful for multi-line strings and avoiding quoting issues. It prevents from escapinging of characters in php EX1 ) $sql = <<<SQL select * from TABLE_NAME where id =1 and product_name = "widgets" SQL; O/...

How to create a class and object in php

class rect { public $length=0; public $width=0; public $area=0; public function getData() { $this->length=10; $this->width=20; } public function area() { $this->area = $this->leng...

Problem with foreach loop for updating array element

If we are traversing an array and need to update an element in some condition then it is quite tricky to do that in foreach loop. For example, if we need to increase each element by 2 of an integer array then we can do that using for loop in t...

Jquery vallidator rule for filling at least one field between a group

<script type="text/javascript"> $(document).ready(function() { jQuery.validator.addMethod("require_from_group", function (value, element, options) { var numberRequired = options[0]; var selector = options...

Parsing CSV file using php SplFileObject class.

The SplFileObject class provides an object oriented interface for a file. $file="upload_file.csv"; //file to parse Steps: 1) Create SplFileObject class object to the csv file. $srcFile = new SplFileObject($file); 2)Now loop ti...

Kohana issue on GoDaddy Shared Hosting

Recently while working for a project I faced an issue while making the site live. The site was developed with kohana framework and was to be hosted on Godaddy Server (Shared Hosting) and I faced a peculiar issue on the server giving me an erro...
1 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: