我在 Zend 框架中收到此错误:违反完整性约束:1048 列 'url_id' 不能为空
我的代码是:
$stmt = $this->select()->where('url_address = ?', $url_address)->query();
$r = $stmt->fetchAll();
print_r($r);
if(count($r)==0){
$data = array(
'url_address' => $url_address,
);
$this->insert($data);
$stmt = $this->select()->where('url_address = ?', $url_address)->query();
$r = $stmt->fetchAll();
}
echo $r->url_id;
return $r->url_id;