Posts Tagged ‘kapil’

  First you need to check whether the user or data is exits or not. then you can perform the update and insert operation. $this->db->where(‘user_id’,$id); $q = $this->db->get(‘profile’); if ( $q->num_rows() > 0 ) { $this->db->where(‘user_id’,$id); $this->db->update(‘profile’,$data); } else { $this->db->set(‘user_id’, $id); $this->db->insert(‘profile’,$data); }   There is one more way by using mysql query $query […]

Suppose you have approx 1000 image files for download, then here is a command to download all them. Create a text file named it urls.txt enter all urls each url in a new line type WGET -i urls.txt in your terminal WGET -i urls.txt

Codility brackets opening closing. codility brackets opening closing. codility you are given a string s consisting of n brackets opening problem solution. function isBalanced($str){ $count = 0; $ocount = 0; $ccount = 0; $length = strlen($str); for($i = 0; $i < $length; $i++){ if($str[$i] == ‘(‘) $ocount += 1; else if($str[$i] == ‘)’) $ccount += […]

Hey, Today we learn how to send push notification for android in php. First create a class with following code   <?php class Pusher{ const GOOGLE_GCM_URL = ‘’; private $apiKey; private $proxy; private $output; public function __construct($apiKey, $proxy = null) { $this->apiKey = ‘your_key’; $this->proxy = $proxy; } /** * @param string|array $regIds * @param […]

configure ejabberd xmpp ubuntu server part 2 In First Tutorial we have configure ejabberd XMPP with default menisa database . now in this tutorial i will explain how to configure ejabberd with MySql .     Step 1 :  Open etc/ejabberd/ejabberd.cfg file and comment following line : {auth_method, internal}. and add the following line in […]

Configure ejabberd xmpp ubuntu server     After facing so many issues and investing so many hours I write below steps for configure ejabberd. In first tourial we learn how to configure ejabbere on AWS EC 2 Ubuntu server. In second tutorial we will configure it with mysql. Step 1: First Update Ubuntu Server  with […]

Joomla Last Database Query     Joomla last database query.As we all know it is a bit difficult to find last executed query in CMS. because there are lots of internal trigger and threads are running. But there is a simple way to find last database query in joomla.     The Query Joomla’s database […]

unzip folder files using php code some time you want to extract files from a zip on a website but you didn’t have sufficient rights or cpanel to extract that , you have on;y ftp details only in that case you need a code to extract that zip. following can help you to do that. […]

set permission for magento – magento-cleaning If you are facing issue of permissions or internal server error then try to set permission to magento folder that might help you. set 777 for media , var and app/etc folder and for rest of file and folders create a file with name “magento-cleaning.php” and paste the blow […]

recursive function getting parent child A recursive function is a function that calls itself during its execution. This enables the function to repeat itself several times, outputting the result and the end of each iteration. function categoryChild($id) { $s = “SELECT ID FROM PLD_CATEGORY WHERE PARENT_ID = $id”; $r = mysql_query($s); $children = array(); if(mysql_num_rows($r) […]