我有两个变量$code
和$name
. $code probably have tutor's code or institute's code and
$name 也可能有导师的名字或学院的名字。
这就是名字的来源$code
和$name
// Check Tutor or Institute
if ( $tutorCode && $tutorName) {
$code = $tutorCode;
$name = $tutorName;
} elseif ( $instituteCode && $instituteName) {
$code = $instituteCode;
$name = $instituteName;
}
我的问题是我需要contact
根据这个$code
和从表中获取电子邮件地址$name
。需要检查两个表tutor
,institute
分别属于代码和名称。
tutor
和institute
表有contact_id
和contact
表也有contact_id
。
tutor
表有tutor_code
和tutor_name
。
institute
表有institute_code
和institute_name
我尝试过这样的事情。但不能检查两个表。
$q = "SELECT email FROM tutor
WHERE tutor_code = $code AND tutor_name = $name"
希望有人能帮助我。谢谢你。