我有两个变量$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"
希望有人能帮助我。谢谢你。