在所选列中插入数据

I am using cakephp with php, I have table with field id having data type auto number.

In my form I do not have any field with id that's why it sets blank in my model and when I tries to save data it gives error.

how can I insert data into selected columns using model in cakephp?

When you pull the form data, make sure you are using an array with the model name and field names. For example, if you are saving a book to the book model, the array would look something like:

$data['Book']['name'] = 'Title of Book';
$data['Book']['author'] = 'Name of Author';
$data['Book']['pages'] = 205; // number of pages

Then when you save the data, you must call create, then save:

$this->Book->create();
$this->Book->save($data);

This will automatically add the ID (whether auto-increment or UUID) and save the new record.