dqtu14636 2017-03-15 03:57
浏览 12

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

I want to make an id obscuring into my table. I was trying to hash table = md5 or any other hashing algorithm , but how can my id hashed into my $data array

my table look like this

table_mysql

enter image description here

depending on my id I want to send it to my hash columns, but how can I do it without doing an hidden input? add product controller

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'));
            }
        }
    }

model

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

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 基于卷积神经网络的声纹识别
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题