Page 1 of 1

PHP CLASS DB QUERY

Posted: Tue May 23, 2006 9:45 pm
by poyor7
Hi....

I've problem on how to use JOIN query in PHP class...currently my coding is querying one table....so my question is what should i add in my existing code..i mean i this particular line:

Code: Select all

$this->strQuery = " Select action, ldesc, ctime , ip FROM " . $this->member_table ."" ;
The Database:
var $member_table = "member_log";
var $member_info_table = "member_info";

Code: Select all

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 ;  	
    }  

}
Regards
Poyor7

Re: PHP CLASS DB QUERY

Posted: Wed May 24, 2006 1:37 am
by timvw
[quote="poyor7"
I've problem on how to use JOIN query in PHP class[/Quote]

Why do you want to perform a join in the first place?

Which data do you need? And how are the two tables related to each other?

The most basic stuff about joins is explained in most tutorials, here's the first one i encountered when i searched the web for 'sql join': http://www.w3schools.com/sql/sql_join.asp.