How to insert $request->param() data into the database
L
L 2019-06-15 21:12:29
0
4
1744

捕获.PNG

L
L

reply all(3)
!
可以看看这个
public function add()
{
    if ($this->request->isAjax()) {
        $data = [
            'icon'   => $this->request->post('icon'),
            'title' => $this->request->post('title'),
            'orderby'  => $this->request->post('orderby')
        ];
        $this->service->addShopCate($data);
        $this->response();
    } else {
        return $this->fetch();
    }
}

锅锅不黑

param() obtains the entire object, and there are many things in it that are not fields in your data table. You must first print out the data in $data and take a closer look at your code, such as saving the user name. The $data['username'] you submitted is not what you want. You have to find the parameters you need first and then save them.

殘留の回憶

I don’t understand what your problem is. Isn’t the code for inserting into the database already written in your program?

  • reply However, I cannot insert directly using $data and always get an error because the type is incorrect.
    L author 2019-06-16 23:20:24
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template