I've problem on how to use JOIN query in PHP class...currently my coding is querying one table....
var $member_table = "member_log";
var $member_info_table= "member_info";
so my question is what should i add in my existing code..i mean this particular line so that i can query member_info_table(JOIN):
$this->strQuery = " Select a,b ,c, d FROM "
. $this->member_table ."" ;?
The Code:
function search_Log_Query() {
$use_where_stmt = false;
$this->strQuery = " Select a,b ,c, d FROM "
. $this->member_table ."" ;
}
Regards
Poyor7Not sure if you are asking for help on join syntax or something else. The mysql online manual has plenty of examples. Here is another one showing a join between an account table and a member table.
$sql = <<<EOD
SELECT
account.account_id AS accountId,
member.member_id AS memberId
FROM
account AS account
LEFT JOIN
member AS member ON account.account_id = member.account_id
;
EOD;H...
Yes actually asking how to do JOIN two table using mysql....of-course if normal syntax i know how to do it...but the problem now....i do it in PHP CLASS so i need to know how should i do it...
From existing code..i mean this line:
$this->strQuery = " Select action, ldesc, ctime , ip FROM "
. $this->member_table ."" ;
How can i modify the code so i can use JOIN query?
Regards
Poyor7This is one of the hassles of a database abstraction layer; a lot of the time it only allows you to do whatever the class author thought you might want you to do.
In short, it depends on the class.H...
Yes actually asking how to do JOIN two table using mysql....of-course if normal syntax i know how to do it...but the problem now....i do it in PHP CLASS so i need to know how should i do it...
From existing code..i mean this line:
$this->strQuery = " Select action, ldesc, ctime , ip FROM "
. $this->member_table ."" ;
How can i modify the code so i can use JOIN query?
Regards
Poyor7
Hmmm. Maybe you need to post the class code? I can answer your question by saying:
$this->strQuery = " Select action, ldesc, ctime , ip FROM "
. $this->member_table . " " .
"LEFT JOIN {$this->$member_info_table} ON " .
"{$this->member_table}.id = {$this->member_info_table}.id .
";\n";
But some how I don't think that's really what you are asking for.
var $member_table = "member_log";
var $member_info_table= "member_info";
so my question is what should i add in my existing code..i mean this particular line so that i can query member_info_table(JOIN):
$this->strQuery = " Select a,b ,c, d FROM "
. $this->member_table ."" ;?
The Code:
function search_Log_Query() {
$use_where_stmt = false;
$this->strQuery = " Select a,b ,c, d FROM "
. $this->member_table ."" ;
}
Regards
Poyor7Not sure if you are asking for help on join syntax or something else. The mysql online manual has plenty of examples. Here is another one showing a join between an account table and a member table.
$sql = <<<EOD
SELECT
account.account_id AS accountId,
member.member_id AS memberId
FROM
account AS account
LEFT JOIN
member AS member ON account.account_id = member.account_id
;
EOD;H...
Yes actually asking how to do JOIN two table using mysql....of-course if normal syntax i know how to do it...but the problem now....i do it in PHP CLASS so i need to know how should i do it...
From existing code..i mean this line:
$this->strQuery = " Select action, ldesc, ctime , ip FROM "
. $this->member_table ."" ;
How can i modify the code so i can use JOIN query?
Regards
Poyor7This is one of the hassles of a database abstraction layer; a lot of the time it only allows you to do whatever the class author thought you might want you to do.
In short, it depends on the class.H...
Yes actually asking how to do JOIN two table using mysql....of-course if normal syntax i know how to do it...but the problem now....i do it in PHP CLASS so i need to know how should i do it...
From existing code..i mean this line:
$this->strQuery = " Select action, ldesc, ctime , ip FROM "
. $this->member_table ."" ;
How can i modify the code so i can use JOIN query?
Regards
Poyor7
Hmmm. Maybe you need to post the class code? I can answer your question by saying:
$this->strQuery = " Select action, ldesc, ctime , ip FROM "
. $this->member_table . " " .
"LEFT JOIN {$this->$member_info_table} ON " .
"{$this->member_table}.id = {$this->member_info_table}.id .
";\n";
But some how I don't think that's really what you are asking for.