note 114445 deleted from pdo.prepared-statements by cmb

From: Date: Tue, 08 Sep 2015 22:20:55 +0000
Subject: note 114445 deleted from pdo.prepared-statements by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-203746@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- /** Добавить модификации документа */ public function insert_doc_modification($doc_id , array $notice ,array $modification_fields) { $fields = array_keys($modification_fields); $sql = "INSERT INTO doc_modification (doc_id , " . implode( ",", $fields ) . ") VALUES (:doc_id , :" . implode( ", :", $fields ) . " ) ON DUPLICATE KEY UPDATE hash = :hash ; "; $stmt = $this->pdo->prepare($sql); $stmt->bindParam(':doc_id',$doc_id); //Создать бинды по полям foreach($modification_fields as $name => $val) { $stmt->bindParam(':'.$name, $modification_fields[$name]); } //Обойти все модификации по документу foreach($notice as $value) { foreach($modification_fields as $name => $val) { if(empty($value[$name])) continue ; $modification_fields[$name] = $value[$name]; } $stmt->execute(); } }

« previous php.notes (#203746) next »