$where_search_arr[] = "a.another_name like '%{$condition}%'"; $where_search_arr[] = "a.address like '%{$condition}%'"; $where_search_arr[] = "a.tel like '%{$condition}%'"; $where_search_arr[] = "REPLACE(a.tel , '-', '') like '%{$condition}%' "; $where_search_arr[] = "a.present like '%{$condition}%'"; $where_search_arr[] = "b.user_name like '%{$condition}%'"; } $where_corporate = implode(' OR ', $where_search_arr); if (!empty($where_corporate)) { $wherearr[] = "( {$where_corporate} )"; } } } // $page内容は関数内部更新されます。 $tantou_names = array(); $data = $corporate_dao->search($wherearr, $page); if (is_array($data)) { foreach ($data as $key => $v) { $sql = sprintf("select * from mp_corporate_tantou where corporate_id = '%s'", mysql_real_escape_string($v['id'])); $corporate_tantou_forms = $corporate_tantou_dao->get_rows($sql); $tantou_name = array(); if ($corporate_tantou_forms) { foreach ($corporate_tantou_forms as $key => $tv) { $tantou_name[] = $tv['tantou_name']; } } $tantou_names[] = implode('/', $tantou_name); } } /** * $sql = sprintf ( "select * from mp_corporate_tantou where corporate_id = '%s'", mysql_real_escape_string ( $id ) );