本文整理汇总了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();
}
示例2: getTiposClientes
public function getTiposClientes()
{
$loConnection = new Connection();
$stmt = $loConnection->prepare('SELECT * FROM tiposClientes WHERE status <> 0');
$stmt->execute();
return $stmt->fetchAll();
}
示例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();
}
示例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();
}
示例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');
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}