var_dump中显示的空字段

时间:2015-01-09 09:49:48

标签: php html mysql

我正在尝试更新产品的所有字段都在更新,除了一个字段是产品名称

下面是我的var_dump

string 'UPDATE product SET

`discription` = 'sasasaas',

`product_name` ='',

category_id = 14,

price=10000,

first_price=1000,

second_price=1000,

third_price=10000,

fourth_price=10000,

total_discount=10000,

product_quantity_discount=10000,

weight=10000,

dimension=1000,

`shipping_class`='sasasas',

stock_quantity=1000,

`stock_status`='inorder',

`back_order`='ALLow'

WHERE product_id = 13' (length=511)

我的问题是,为什么我收到product_name =“”为空?

这是我的代码!!

  <label for="exampleInputEmail1">Product Name</label>
  <input type="text" name="product_name" class="form-control" value="<?php   
  echo($row['product_name']);?>">


$this->product_discription = trim ( mysql_prep ( $_POST ['discription'] ) );
    $this->category_id = mysql_prep ( $_POST ['data_category'] );
    $this->regular_price = trim ( mysql_prep ( $_POST ['regular_price'] ) );
    $this->price1 = trim ( mysql_prep ( $_POST ['price1'] ) );
    $this->price2 = trim ( mysql_prep ( $_POST ['price2'] ) );
    $this->price3 = trim ( mysql_prep ( $_POST ['price3'] ) );
    $this->price4 = trim ( mysql_prep ( $_POST ['price4'] ) );
    $this->total_discount = trim ( mysql_prep ( $_POST ['total_discount'] ) );
    $this->product_qantity_discount = trim ( mysql_prep ( $_POST ['quantity_discount'] ) );
    $this->weight = trim ( mysql_prep ( $_POST ['weight'] ) );
    $this->dimension = trim ( mysql_prep ( $_POST ['dimension'] ) );
    $this->shipping_class = trim ( mysql_prep ( $_POST ['shipping'] ) );
    $this->stock_quantity = trim ( mysql_prep ( $_POST ['stock'] ) );
    $this->stock_status = mysql_prep ( $_POST ['stock_status'] );
    $this->back_order = mysql_prep ( $_POST ['back_order'] );
    $this->product_name =  mysql_prep ( $_POST ['product_name'] ) ;
    $this->id = $_GET ['id'];

    $this->sql = "UPDATE product SET

                        `discription` = '{$this->product_discription}',
                        `product_name` ='{$this->product_name}',
                        category_id = {$this->category_id},
                        price={$this->regular_price},
                        first_price={$this->price1},
                        second_price={$this->price2},
                        third_price={$this->price3},
                        fourth_price={$this->price4},
                        total_discount={$this->total_discount},
                        product_quantity_discount={$this->product_qantity_discount},
                        weight={$this->weight},
                        dimension={$this->dimension},
                        shipping_class='{$this->shipping_class}',
                        stock_quantity={$this->stock_quantity},
                        stock_status='{$this->stock_status}',
                        back_order='{$this->back_order}'
                        WHERE product_id = {$this->id}";

      mysql_query($this->sql);
      confirm_query($this->sql);
    echo    var_dump($this->sql ,TRUE);

1 个答案:

答案 0 :(得分:1)

看来你这里有一个错字:

$this->produt_name