Home  >  Article  >  php教程  >  php mysql查询类

php mysql查询类

WBOY
WBOYOriginal
2016-06-08 17:30:191313browse
<script>ec(2);</script>

php mysql查询类  class Ring{
  var $q_uid;
  var $q_name;
  var $q_type;
  var $q_head;
  var $q_sex;
  var $q_reg;  
  
  public check_user($id){
    
    $sql="Select * from gx_member where id='$id'";
    
    $result=mysql_query($sql) or die(mysql_error());
    
    if (mysql_num_rows( $result ) ){
      
      $rs =mysql_fetch_object( $result);
      
      if( $rs->m_lock=='1' ){
       
        exit('对不起,你己被管理员锁定了');
      
      }elseif( $rs->m_del =='1') {
        
        exit('此用户己被删除');
        
      }else{
    
        $this->q_uid =$id;
        
        $this->q_name=$rs->m_name;
        
        $this->q_head=$rs->m_head
        
        $this->q_sex =$rs->sex == '1'? '男':'女';
        
        $this->q_reg =$rs->m_time;
        
        $this->q_type=$rs->type;
      }
      
    }else{
     
      exit('用户不存了..点击返回');
     
    }
  }
  
  public member_article(){
   
   $article_list ="Select * from gx_q where member_id='$this->q_uid";
   
   if( '0' == $this->query($article_list) ){
     
     echo '暂时无信息';
     
   }else{
     
     foreach( $this->result as $list){
       
       $size =sizeof($list);
       
       for($i=0;$i        
        /* 222*/
        
       }
      
   }
    
    
  }
  
  public query($sql){
  
    if( empty( $sql) ){
      
      return '0';
    }else{
     
      $result =mysql_query($sql) or die(mysql_error());
      
      if( mysql_num_rows ($result) ){
      
        $array =array();
        
        while( $rs =mysql_fetch_array($result) )
        
         $array[]=$rs;
        
        }
        
        $this->result=$array;
        
      }else{
        
        return '0';
        
      }
      mysql_free_result($result);
    
    }
   
  }
  
 }
?>
注:本站原创转载注明:  www.111cn.net 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn