我的数据库中还有一个日期字段,其日期数据类型未设置为 null
这是我的观点——我应该在这里添加一些额外的东西吗?
foreach($blogs AS $viewData)
{
$id = $viewData->id;
$title = $viewData->title;
$body = $viewData->body;
$username = $viewData->username;
$date = $viewData->date;
?>
<b> <?=$title?></b>
<p><?=$body?></p>
<p>posted by:<?=$username?></p>
<p>date: <?=$date?></p>
<hr>
这是我插入数据库的模型中的函数...
public function insert_entry()
{
$this->title = $this->input->post('title');
$this->body = $this->input->post('text');
$this->username = $this->session->userdata('username');
$this->date = time();// is there something I should change here?
$this->db->insert('blogs', $this);
}