當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Connection::prepare方法代碼示例

本文整理匯總了PHP中Connection::prepare方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connection::prepare方法的具體用法?PHP Connection::prepare怎麽用?PHP Connection::prepare使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Connection的用法示例。


在下文中一共展示了Connection::prepare方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getAll

 public static function getAll()
 {
     static::getConnection();
     $prep = static::$con->prepare('SELECT * FROM ' . static::getTableName());
     $prep->execute();
     return $prep->fetchAll();
 }
開發者ID:Amethyst-web,項目名稱:amethyst-ws,代碼行數:7,代碼來源:BaseModel.php

示例2: getTiposClientes

 public function getTiposClientes()
 {
     $loConnection = new Connection();
     $stmt = $loConnection->prepare('SELECT * FROM tiposClientes WHERE status <> 0');
     $stmt->execute();
     return $stmt->fetchAll();
 }
開發者ID:Wenemy,項目名稱:TrabalhoJoabe,代碼行數:7,代碼來源:TiposClientes.php

示例3: delete

 public function delete($id)
 {
     $sql = "DELETE FROM {$this->table} WHERE id = :id";
     $stmt = Connection::prepare($sql);
     $stmt->bindParam(':id', $id, PDO::PARAM_INT);
     return $stmt->execute();
 }
開發者ID:czucherato,項目名稱:camuswssystem,代碼行數:7,代碼來源:Crud.php

示例4: findCatSubcat

 public function findCatSubcat()
 {
     $sql = "SELECT categoria.id AS 'id_categoria', categoria.nome AS 'categoria', \nsubcategoria.id AS 'id_subcategoria', subcategoria.nome AS 'subcategoria'\nFROM tbl_subcategorias subcategoria INNER JOIN tbl_categorias categoria\nON subcategoria.id_categoria = categoria.id ORDER BY categoria.nome";
     $stmt = Connection::prepare($sql);
     $stmt->execute();
     return $stmt->fetchAll();
 }
開發者ID:czucherato,項目名稱:camuswssystem,代碼行數:7,代碼來源:Subcategoria.php

示例5: setCliente

 public function setCliente(array $laCliente)
 {
     $loConnection = new Connection();
     $stmt = $loConnection->prepare('INSERT INTO clientes(nome,cpf,tipoCliente,ativo,status) VALUES ("' . $laCliente['nome'] . '","' . $laCliente['cpf'] . '","' . $laCliente['tipoCliente'] . '",1,1)');
     $stmt->execute();
     header('location:index.php');
 }
開發者ID:Wenemy,項目名稱:TrabalhoJoabe,代碼行數:7,代碼來源:Clientes.php

示例6: abstractFindAll

 /**
  * @return KVDdom_LazyDomainObjectCollection
  */
 protected function abstractFindAll()
 {
     $sql = $this->getFindAllStatement();
     $this->_sessie->getSqlLogger()->log($sql);
     $stmt = $this->_conn->prepare($sql);
     return $this->executeFindMany($stmt);
 }
開發者ID:Tjoosten,項目名稱:kvd,代碼行數:10,代碼來源:KVDdom_PDODataMapper.class.php

示例7: deleteById

 public function deleteById($id)
 {
     $this->id = $id;
     $dbh = new Connection();
     $sql = 'DELETE FROM ' . static::TABLE . ' WHERE id=' . $id;
     $sth = $dbh->prepare($sql);
     $sth->execute();
 }
開發者ID:Alexandr1987,項目名稱:PHP1,代碼行數:8,代碼來源:Models.php

示例8: update

 public function update($id)
 {
     $sql = "UPDATE {$this->table} SET nome = :nome WHERE id = :id";
     $stmt = Connection::prepare($sql);
     $stmt->bindParam(':nome', $this->nome);
     $stmt->bindParam(':id', $id);
     return $stmt->execute();
 }
開發者ID:czucherato,項目名稱:camuswsecommerce,代碼行數:8,代碼來源:Categoria.php

示例9: update

 public function update($title, $id)
 {
     $this->id = $id;
     $this->title = $title;
     $dbh = new Connection();
     $sql = "UPDATE new_news SET title='{$title}' WHERE id='{$id}'";
     $sth = $dbh->prepare($sql);
     $sth->execute();
 }
開發者ID:Alexandr1987,項目名稱:blog,代碼行數:9,代碼來源:Models.php

示例10: install_all

function install_all($install)
{
    $connection = Connection::prepare(new Config(new PostgresType(), host, port, user, pass));
    $connection->connect();
    $connection->begin();
    install_packages($connection, $install);
    $connection->commit();
    $connection->close();
}
開發者ID:exildev,項目名稱:corvus,代碼行數:9,代碼來源:install.php

示例11: update

 public function update($files, $cook)
 {
     $this->files = $files;
     $this->cook = $cook;
     $dbh = new Connection();
     $sql = "UPDATE info SET img='{$files}' WHERE login='{$cook}'";
     $sth = $dbh->prepare($sql);
     $sth->execute();
 }
開發者ID:Alexandr1987,項目名稱:blog,代碼行數:9,代碼來源:Login.php

示例12: insert

 public function insert($text, $avtor, $id_news)
 {
     $this->text = $text;
     $this->avtor = $avtor;
     $this->id_news = $id_news;
     $dbh = new Connection();
     $sql = "INSERT INTO coments (text, avtor, id_news, date)VALUE ('" . $text . "','" . $avtor . "','" . $id_news . "',NOW())";
     $sth = $dbh->prepare($sql);
     $sth->execute();
 }
開發者ID:Alexandr1987,項目名稱:blog,代碼行數:10,代碼來源:Coments.php

示例13: insert

 public function insert($name, $text, $avtor, $img_src = '')
 {
     $this->name = $name;
     $this->text = $text;
     $this->avtor = $avtor;
     $this->img_src = $img_src;
     $dbh = new Connection();
     $sql = "INSERT INTO golos (title, text, avtor, img, date) VALUES ('" . $name . "','" . $text . "','" . $avtor . "','" . $img_src . "',NOW())";
     $sth = $dbh->prepare($sql);
     $sth->execute();
 }
開發者ID:Alexandr1987,項目名稱:blog,代碼行數:11,代碼來源:Golos.php

示例14: update

 public function update(Connection $connection)
 {
     $sth = $connection->prepare($this->statement);
     $field = explode('_', $this->table)[2];
     $seeder = explode('_', $this->table)[1] . 'r_' . explode('_', $this->table)[0];
     $getTotalCount = $connection->prepare('SELECT count(*) FROM prod');
     $getTotalCount->execute();
     $times = (int) $getTotalCount->fetch(PDO::FETCH_ASSOC)['count'];
     $getFirstId = $connection->prepare('SELECT id FROM prod ORDER BY id LIMIT 1');
     $getFirstId->execute();
     $firstId = (int) $getFirstId->fetch(PDO::FETCH_ASSOC)['id'];
     if (method_exists($this, $seeder)) {
         $generator = $this->{$seeder}($times, $sth, $firstId);
         foreach ($generator as $stmt) {
             $result = $stmt->execute();
         }
     } else {
         throw new Exception('No rules to seed ' . $this->table . ' table');
     }
     return $result;
 }
開發者ID:glebec-v,項目名稱:dba.lessons,代碼行數:21,代碼來源:Make.php

示例15: scheduleForChannelAndLocale

    /**
     * {@inheritdoc}
     */
    public function scheduleForChannelAndLocale(ChannelInterface $channel, LocaleInterface $locale)
    {
        $sql = <<<SQL
            DELETE c FROM pim_catalog_completeness c
            WHERE c.channel_id = :channel_id
            AND c.locale_id = :locale_id
SQL;
        $sql = $this->applyTableNames($sql);
        $stmt = $this->connection->prepare($sql);
        $stmt->bindValue('channel_id', $channel->getId());
        $stmt->bindValue('locale_id', $locale->getId());
        $stmt->execute();
    }
開發者ID:ashutosh-srijan,項目名稱:findit_akeneo,代碼行數:16,代碼來源:CompletenessGenerator.php


注:本文中的Connection::prepare方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。