我怎样才能让id进入我的桌子?

时间:2017-03-15 03:57:18

标签: php mysql codeigniter hash

我想让一个id模糊到我的桌子里。我试图哈希table = md5或任何其他哈希算法,但我的id怎么能进入我的$data数组

我的表看起来像这样

table_mysql

enter image description here

取决于我的ID我想将它发送到我的哈希列,但是如何在不进行隐藏输入的情况下执行此操作? 添加产品控制器

public function addProduct(){
        $descripcion = $this->input->post('description');
        $cost_price =  $this->input->post('cost_price');
        $selling_price = $this->input->post('selling_price');
        $wprice = $this->input->post('wprice');
        $min_stock = $this->input->post('min_stock');
        $stock = $this->input->post('stock');
        $max_stock = $this->input->post('max_stock');
        $data = array(
            'codigo' => $this->codeGenerator(4),
            'descripcion' => $descripcion,
            'precio_compra' => $cost_price,
            'precio_venta' => $selling_price,
            'precio_mayoreo' => $wprice,
            'existencia_minima' => $min_stock,
            'existencia' => $stock,
            'existencia_maxima' => $max_stock
        );

        if ($data['existencia'] > $data['existencia_minima']) {
            $this->json(array('min_stock' => 'el stock no puede ser mayor al min'));
        }elseif ($data['existencia_maxima'] < $data['existencia']) {
            $this->json(array('max_stock' => 'el stock no puede ser mayor al max'));
        }else{
            if (!$this->products->isExistsProduct($data)) {
                $this->products->addProduct($data);
                $this->json(array('msg' => 'successfully added'));
            }else{
                $this->json(array('duplicate' => 'product already exists'));
            }
        }
    }

模型

public function addProduct($data){
        $this->db->insert('storelte_articulos',$data);
    }

0 个答案:

没有答案