1

zend Framework を使用してテーブルにデータを挿入したい。次のテーブル構造があります

ここに画像の説明を入力

このテーブルにデータを挿入しようとすると、エラーが見つかりました

 Zend_Db_Table_Exception: A table must have a primary key, but none was found

protected $_primary ='id'テーブルで指定すると、エラーが見つかりました

Primary key column(s) (id) are not columns in this table ()

テーブルを削除してゼロから作成しましたが、すべて無駄です。私は何時間もこの問題を解決しようとしてきましたが、解決策はありません。

私のモデルは次のようになります

protected $_name = "affiliate_specialities_banners";
//protected $_primary = 'id';
protected $_adapter = null;

public function init() {
    $this->_adapter = $this->getAdapter();
}

public function addData($data) {
    try {

        $id = $this->insert($data);
    } catch (Zend_Db_Adapter_Exception $e) {

        die($e->getMessage());
    }
    return $id;
}

何か提案をください......

4

1 に答える 1