开发者

php prepared statements

开发者 https://www.devze.com 2023-03-09 01:50 出处:网络
public function insert_data($array){ $db = new MySQLi(HOST,USER,PASS,DB); $var = \"adam\"; $stmt = $db->stmt_init();
    public function insert_data($array){
        $db = new MySQLi(HOST,USER,PASS,DB);
        $var = "adam";
        $stmt = $db->stmt_init();
        $query = "INSERT INTO `pages` (`name`,`text`,`image`,`meta_desc`,`meta_k开发者_如何学编程w`,`meta_author`,`image_thumb`) VALUES (? ? ? ? ? ? ?)";
        $stmt->prepare($query); 
        $stmt->bind_param('sssssss',$var,$var,$var,$var,$var,$var,$var);
        $stmt->execute();
    }

my mysqli-> prepare returns false, and i dont understand why.

can any one see what i am doing wrong here?

thanks


VALUES (? ? ? ? ? ? ?) should be VALUES (?, ?, ?, ?, ?, ?, ?)


Don't you need commas between ? ?

0

精彩评论

暂无评论...
验证码 换一张
取 消