I want for a row that get of database table forch it for echo each a but have following error:
$query = $this -> db -> query('
SELECT
@rownum := @rownum + 1 rownum,
tour_foreign.id,
tour_foreign.name,
MIN(tour_foreign_residence.name_re) AS name_re,
tour_foreign.service,
tour_foreign.date_go,
tour_foreign.date_back,
tour_foreign.term,
tour_foreign.useradmin_submit,
tour_foreign.date_submit,
GROUP_CONCAT( tour_foreign_residence.name_re
ORDER BY tour_foreign_residence.name_re
SEPARATOR " "
) AS name_re_all
FROM tour_foreign
INNER JOIN tour_foreign_residence
ON ( tour_foreign.id = tour_foreign_residence.relation )
JOIN (SELECT @rownum := 0) r
WHERE tour_foreign.name LIKE "%' . $find . '%"
OR tour_foreign_residence.name_re LIKE "%' . $find . '%"
GROUP BY tour_foreign.id ');
foreach ($query->result() as $row) {
echo $row->name_re_all //thisoutput is: 11111 22222 33333 44444 ...
foreach ($row->name_re_all as $val) {
echo $val . '<br>';
}
}
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: core/Loader.php(679) : eval()'d code
Line Number: 86
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…