Posts Tagged ‘mysql’

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

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

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

select a field which contain multiple value ,mysql query for searching a field that contain multiple value seprated by comma id name colors 1 kapil 1,2,3 2 mohit 2,1 3 deepak 1,3 select * from shirts where find_in_set(‘1’,colors) <> 0