是否有可能插入if else語句爲每個如果還有其他的陳述?
我想添加一些如果else我的聲明。
我只是想設置沒有值數據顯示爲無。
如果它有值,那麼它將返回數據。
TABLE:wp_events_answer
╔════╦══════════════╦════════════╗
║ id ║ answer ║question_id ║
╠════╬══════════════╬════════════╣
║ 1 ║ Maybank ║ 12 ║
║ 2 ║ no value ║ 12 ║
║ 3 ║ no value ║ 12 ║
║ 4 ║ CIMB ║ 12 ║
╚════╩══════════════╩════════════╝
=
$number = 1;
foreach ($datas as $data) {
$result .= '<tbody>';
$result .= '<tr>';
$result .= '<td>';
$result .= $number++;
$result .= '</td>';
$result .= '<td>';
$result .= $data->fname;
$result .= ' ';
$result .= $data->lname;
$result .= '</td>';
$result .= '<td>';
//#### PLEASE TAKE A LOOK HERE #####
if($result .= '')
{
$result .= 'None';
}
else
{
$result .= $data->answer;
}
// #### END ####
$result .= '</td>';
}
$result .= '</tr>';
$result .= '</table>';
return $result;
+1爲ASCII藝術桌XD –