I have two variables $code
and $name
. $code probably have tutor's code or institute's code and
$name also probably have tutor's name or institute's name.
This is the way the names come to $code
and $name
// Check Tutor or Institute
if ( $tutorCode && $tutorName) {
$code = $tutorCode;
$name = $tutorName;
} elseif ( $instituteCode && $instituteName) {
$code = $instituteCode;
$name = $instituteName;
}
My problem is I need to get email address from contact
table according to this $code
and $name
. Need to check two table tutor
and institute
which belong to code and name.
tutor
and institute
table have contact_id
and contact
table also have contact_id
.
tutor
table have tutor_code
and tutor_name
.
institute
table have institute_code
and institute_name
I tried something like this. but can't check in both tables.
$q = "SELECT email FROM tutor
WHERE tutor_code = $code AND tutor_name = $name"
Hope someone will help me. Thank you.
See Question&Answers more detail:os