我想在D.O.B中搜索这些字段“birth_day”,“birth_month”
function search_users($term, $limit = 10, $friends = false) {
$sql = "SELECT * FROM `users` WHERE
(username LIKE '%{$term}%' OR first_name LIKE '%{$term}%' OR last_name LIKE '%{$term}%' OR email_address LIKE '%{$term}%') AND bannned='0'
";
答案 0 :(得分:1)
$combined = $term;
$searchfield = explode(" ", $combined);
$sql = "SELECT * FROM `users` WHERE
(username LIKE '%{$term}%' OR first_name LIKE '%{$term}%' OR last_name LIKE '%{$term}%' OR email_address LIKE '%{$term}%' OR birth_month LIKE '%{$term}%' OR birth_day LIKE '%{$searchfield[0]}%' ) AND bannned='0'
";