後で使用できる文字列にデータを保存しようとしています。codeigniterを使用してデータベースクエリから文字列を保存する方法
これは私がこれまで持っているコードです:
$phone_numbers = $this->phone_model->get_all()->result();
$string = '';
foreach($phone_numbers as $cel){
$string .= 'Phone #: ';
$string .= $cel->cel_num;
$string .= '<br/>';
}
$data['string'] = $string;
私のデータベースがあります。
id cel_num
1 1324567890
2 1515744243
3 6516515225
以上または
少ないし、私の見解では、私はちょうどそれをそこに持っていることができますecho $string
としてデータをエコーする
$html .='
<br/>
<br/>
<br/>
<br/>
<br/>
<table width="90%" align="center" style="border-bottom: 1px solid #000;">
<tr>
<th style="font-size:14px;" align="center">'.$contact->name.'<br />
<div style="font-size:10px">
'.$contact->addr.'<br />
////////// HERE IS WHERE I WANT TO ECHO THE NUMBERS/////////
'.$string.'
</div>
</th>
</tr>
<tr>
<th style="font-size:12px; font-weight:bold;" align="left">
PHONE BOOK</th></tr>
</table>';
に動作していないですか? – pmahomme
私の見解でそれらをエコーしようとすると – learningbyexample
エコーしているコードはどこですか? – pmahomme