0

出于某种原因,我只能从表中选择数据,但不能插入。

即功能nee()工作正常,但wee()没有......它今天早些时候工作......有人知道原因吗?

Class wtf{
    private $db;
    public function __construct(){
        $this->db = new Store_Connection();
        $this->db = $this->db->dbStore();
    }

    public function nee(){
        $st = $this->db->prepare("select paid from sales where id=14");
        $st->execute();
        $product = $st->fetch(PDO::FETCH_OBJ);
        print_r($product);
    }

    public function wee(){
        $st = $this->db->prepare("insert into sales(paid) values (sdf)");
        $st->execute();

    }

}

$work = new wtf();
$work->wee();
4

2 回答 2

2

试试这样

$st = $this->db->prepare("insert into sales(paid) values ('sdf')");
于 2012-06-30T17:58:22.067 回答
1

什么是sdf?它是文本/字符串,然后在它周围使用 '

于 2012-06-30T17:57:19.837 回答