Log in

View Full Version : Php Classess...db Query



poyor7
05-24-2006, 03:49 AM
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 ;
}

}

Question....i need to retrieve also some data from member_info_table....which is location.So i need only JOIN query only n how should do it in this line? :



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



Regards
Poyor7

jstgermain
05-24-2006, 03:16 PM
$use_where_stmt = false;
$this->strQuery = " Select action, ldesc, ctime , ip FROM " . $this->member_table .", member_info_table" ;


add in the other field names that are in the member_info_table after "ip" and it should work