Php Class...db Query

Discussion in 'PHP' started by poyor7, May 23, 2006.

  1. #1
    Hi...

    I start with DB first

    var $member_table = "member_log";
    -consist of lid,Uid,action,ctime,ldesc,ip
    var $member_info_table = "member_info";
    -consist of member_id,name,location
    where (Uid=member_id)

    The Code Currently querying only member_table
    
    function search_Log_Query() {
    
    $use_where_stmt = false;
    $this->strQuery = " Select action, ldesc, ctime , ip FROM " . $this->member_table ."" ;
    
    if (strlen($this->l_desc) != 0){ 
    if ($use_where_stmt) {
    $this->strQuery .= " and ";
    } else {
    $this->strQuery .= " WHERE " ; 
    $use_where_stmt = true ;
    } 
    $this->strQuery .= " ldesc like '%" . $this->l_desc . "%'"; 
    $use_where_stmt = true ; 
    } 
    
    }
    
    PHP:
    Question....i need to retrieve also some data from member_info_table....which is location.So i need only JOIN query only and how should i add to this code:

    
    $this->strQuery = " Select action, ldesc, ctime , ip FROM " . $this->member_table ."" ;
    
    PHP:

    Regards
    Poyor7
     
    poyor7, May 23, 2006 IP
  2. Bartbos

    Bartbos Peon

    Messages:
    29
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    select action, ldesc, ctime, ip FROM ' . $this->member_table . ' INNER JOIN ' . $this->join_table . ' ON ' . $this->member_info_table . ' ON ' . $this->member_info_table . '.member_id = ' . $this->member_table . '.id';

    Is this what you mean?
     
    Bartbos, May 27, 2006 IP