当前位置: 首页>>代码示例>>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;未经允许,请勿转载。