Posts Tagged ‘kapil sharma’

  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 = ‘https://android.googleapis.com/gcm/send’; 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     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 […]

Php backtrace with proper information.   Php backtrace with proper information. we can use debug_backtrace. But debug_backtrace provide a lots of data which might be not use full for one. So for fetching more accurate information we can use the below code. $e = new Exception; var_dump($e->getTraceAsString());  

Simple Responsive Slider using jquery Here is a Simple Responsive Slider using jquery which works on every breakpoints. A very simple js/jquery which helps you to modify it according to your requirements. Download infinite_Image_Carousel-master

Custom linkedin button for share and auth <script src=”http://platform.linkedin.com/in.js”> api_key: //onLoad: onLinkedInLoad scope: r_basicprofile r_emailaddress r_fullprofile authorize:true </script> <script> function onLinkedInAuth() { IN.API.Profile(“me”) .fields(“firstName”, “lastName”, “industry”, “location:(name)”, “picture-url”, “headline”, “summary”, “num-connections”, “public-profile-url”, “distance”, “positions”, “email-address”, “educations”, “date-of-birth”) .result(displayProfiles); IN.UI.Share().params({ url: “http://www.example.com” }).place() } function displayProfiles(profiles) { console.log(profiles); member = profiles.values[0]; } jQuery(document).ready(function(){ jQuery(“#linkdinlog”).click(function(){ IN.UI.Authorize().place(); IN.Event.on(IN, […]

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) […]

mysql queries 1. Add column age and desg in emp_prof table. Mysql> use profile; Mysql>alter table emp_prof add column age int; Mysql> alter table emp_prof add column desg char(10); 2. Update all records of emp_prof.(desg= actn,officer) Mysql> use profile; Mysql>update emp_prof set age=24,desg=’officer’ where emp_id=101; Mysql>update emp_prof set age=21,desg=’actn’ where emp_id=102; (follow above queries for […]