このコードで.. $code 変数を SQL クエリの where 句に追加する必要があります。
if ( isset( $_POST['code_search_submitted'])) {
if ( isset( $_POST['searchCode']) && !empty( $_POST['searchText'])) {
$searchCode = $_POST['searchCode'];
$searchText = $_POST['searchText'];
echo $searchCode;
echo '<br />';
echo $searchText;
//if (is_numeric( $searchText ) && (strlen($searchText) == 4)) {
$numbers = explode(",", $searchText);
foreach($numbers as $number) {
$numbers = trim($number);
if (ctype_digit($numbers) && (strlen($numbers) == 4)) {
$code = $numbers ;
} else {
echo 'Can not cantain string and more than 4 digists number';
}
}
}
}
これは私のクエリです...
SELECT
tcs.tutor_id AS tid,
t.qualification,
GROUP_CONCAT( DISTINCT o.option_name SEPARATOR ', ') AS tutor_option,
timg.image_name AS img,
city_name AS city,
d.district_name AS district
FROM tutor_category_subject as tcs
INNER JOIN subject AS s ON tcs.subject_id = s.subject_id
INNER JOIN tutors AS t ON tcs.tutor_id = t.tutor_id
INNER JOIN address ON address.address_id = t.address_id
INNER JOIN city ON city.city_id = address.city_id
INNER JOIN district AS d ON d.district_id = city.district_id
LEFT JOIN tutor_images AS timg ON timg.tutor_id = tcs.tutor_id AND timg.image_type = 'profile'
WHERE t.tutor_code = ------------
GROUP BY tcs.tutor_id;
$code 変数には、この 2434,2345,5345,2354 などのメンバー コードがあります。これを where 句で使用する方法を教えてもらえますか?
ありがとうございました...