大家好,我有以下的PHP的,我想在自己的錶行來設置每個echo命令,但我有問題....某處....PHP和表格式
<?php
$db=JFactory::getDBO();
$q = "select * from #__jbjobs_employer where user_id=".$job->employer_id;
$db->setQuery($q);
$employer_record = $db->loadObject();
echo ($employer_record->show_addr == 'y')? "Address: ".$employer_record->street_addr.', '.$employer_record->city.', '.$employer_record->state : JText::_('JBJOBS_NOT_DISPLAYED').'<br>';
echo ($employer_record->show_phone == 'y')? "Phone: ".$employer_record->primary_phone : JText::_('JBJOBS_NOT_DISPLAYED').'<br>';
echo ($employer_record->show_fax == 'y')? "Fax: ".$employer_record->fax_number : JText::_('JBJOBS_NOT_DISPLAYED').'<br>';
$u = JFactory::getUser($job->employer_id);
echo ($employer_record->show_email == 'y')? "Email:".$u->email : JText::_('JBJOBS_NOT_DISPLAYED');
?>
我嘗試使用下面的代碼片段做,而是因爲我什麼都不知道關於PHP,一切都顯示了一條線,看不到表
<?php
$db=JFactory::getDBO();
$q = "select * from #__jbjobs_employer where user_id=".$job->employer_id;
$db->setQuery($q);
$employer_record = $db->loadObject();
'<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>';echo ($employer_record->show_addr == 'y')? "".$employer_record->street_addr : JText::_('JBJOBS_NOT_DISPLAYED').'</tr>
<tr>
<td>';
echo ($employer_record->show_location == 'y')? "".$employer_record->city.', '.$employer_record->state : JText::_('JBJOBS_NOT_DISPLAYED').'</td>
</tr>
<tr>
<td>';
echo ($employer_record->show_phone == 'y')? "".$employer_record->primary_phone : JText::_('JBJOBS_NOT_DISPLAYED').'</td>
</tr>
<tr>
<td>';
echo ($employer_record->show_fax == 'y')? "".$employer_record->fax_number : JText::_('JBJOBS_NOT_DISPLAYED').'</td>
</tr>
<tr>
<td>';
$u = JFactory::getUser($job->employer_id);
echo ($employer_record->show_email == 'y')? "".$u->email : JText::_('JBJOBS_NOT_DISPLAYED');'</td>
</td>
</tr>
</table>'
?>
能有人伸出援助之手嗎?謝謝!!!!
你錯過了第6行的'echo'嗎?我的信息顯示爲 –
,但全部在一行中,沒有表格。 – user2800989
還有一個關閉在第8行丟失。有時表格可能會錯誤,當標籤不匹配 –