php - selecting the data from database except a particular name -


i listing users have registered in users table. want hide name 'superadmin' in name column.

my query this

$sql = "select u.rowid, u.name, u.firstname, u.email, u.job, u.signature, u.office_phone, u.office_fax, u.user_mobile,";         $sql.= " u.admin, u.login, u.webcal_login, u.phenix_login, u.phenix_pass, u.note,";         $sql.= " u.pass, u.pass_crypted, u.pass_temp,";         $sql.= " u.fk_societe, u.fk_socpeople, u.fk_member, u.ldap_sid,";         $sql.= " u.statut, u.lang, u.entity,";         $sql.= " u.datec datec,";         $sql.= " u.tms datem,";         $sql.= " u.datelastlogin datel,";         $sql.= " u.datepreviouslogin datep,";         $sql.= " u.photo photo,";         $sql.= " u.openid openid,";         $sql.= " u.ref_int, u.ref_ext";         $sql.= " ".main_db_prefix."user u";   if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))         {             $sql.= " u.entity not null";         }         else         {             $sql.= " u.entity in (0,".$conf->entity.")";         }          if ($sid)    // permet une recherche du user par son sid activedirectory ou samba         {             $sql.= " , (u.ldap_sid = '".$sid."' or u.login = '".$this->db->escape($login)."') limit 1";         }         else if ($login)         {             $sql.= " , u.login = '".$this->db->escape($login)."'";         }         else         {             $sql.= " , u.rowid = ".$id;         }          dol_syslog(get_class($this)."::fetch sql=".$sql, log_debug);         $result = $this->db->query($sql);         if ($result)         {             $obj = $this->db->fetch_object($result);             if ($obj)             {                 $this->id           = $obj->rowid;                 $this->ref          = $obj->rowid;                  $this->ref_int      = $obj->ref_int;                 $this->ref_ext      = $obj->ref_ext;                  $this->ldap_sid     = $obj->ldap_sid;                 $this->nom          = $obj->name;       // todo deprecated                 $this->lastname     = $obj->name;                 $this->prenom       = $obj->firstname;  // todo deprecated                 $this->firstname    = $obj->firstname;                  $this->login        = $obj->login;                 $this->pass_indatabase = $obj->pass;                 $this->pass_indatabase_crypted = $obj->pass_crypted;                 $this->pass         = $obj->pass;                 $this->pass_temp    = $obj->pass_temp;                 $this->office_phone = $obj->office_phone;                 $this->office_fax   = $obj->office_fax;                 $this->user_mobile  = $obj->user_mobile;                 $this->email        = $obj->email;                 $this->job          = $obj->job;                 $this->signature    = $obj->signature;                 $this->admin        = $obj->admin;                 $this->note         = $obj->note;                 $this->statut       = $obj->statut;                 $this->photo        = $obj->photo;                 $this->openid       = $obj->openid;                 $this->lang         = $obj->lang;                 $this->entity       = $obj->entity;                  $this->datec                = $this->db->jdate($obj->datec);                 $this->datem                = $this->db->jdate($obj->datem);                 $this->datelastlogin        = $this->db->jdate($obj->datel);                 $this->datepreviouslogin    = $this->db->jdate($obj->datep);                  $this->webcal_login         = $obj->webcal_login;                 $this->phenix_login         = $obj->phenix_login;                 $this->phenix_pass_crypted  = $obj->phenix_pass;                 $this->societe_id           = $obj->fk_societe;                 $this->contact_id           = $obj->fk_socpeople;                 $this->fk_member            = $obj->fk_member;                  if (! $this->lang) $this->lang='fr_fr';                  $this->db->free($result); 

is possible union method, me in this. tried adding distinct didn't work. want hide name superadmin

one where condition do:

$sql .= " `u`.`name` <> 'superadmin';"; 

this fetch values except when name = 'superadmin';


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -