本文整理汇总了PHP中Connector::Select方法的典型用法代码示例。如果您正苦于以下问题:PHP Connector::Select方法的具体用法?PHP Connector::Select怎么用?PHP Connector::Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connector
的用法示例。
在下文中一共展示了Connector::Select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: changePromo
function changePromo($newPromo)
{
$bdd = new Connector();
// Check if promo exists
$promo = $bdd->Select("*", "promo", array("where" => array(array("id_promo", "=", $newPromo))));
if (!$promo) {
throw new LengthException("La promo n'existe pas");
}
// Change promo in both object and BDD
$this->promo = $newPromo;
$this->libelle_promo = $promo[0]["libelle"];
$bdd->Update("document", array("where" => array(array("id", "=", $this->id)), "set" => array("promo" => $this->promo)));
}
示例2: write
function write()
{
$bdd = new Connector();
$promo = $bdd->Select("*", "promo", array("where" => array(array("id_promo", "=", $this->id_promo))));
if (!$promo) {
throw new UnexpectedValueException("La promo n'existe plus en base de données");
}
$promo = $promo[0];
$attrs = get_object_vars($this);
$toUpdate = array();
foreach ($attrs as $key => $value) {
if ($value != $promo[$key]) {
$toUpdate[$key] = $value;
}
}
$bdd->Update("promo", array("set" => $toUpdate, "where" => array(array("id_promo", "=", $this->id_promo))));
}
示例3: getAll
public static function getAll()
{
$bdd = new Connector();
$datas = $bdd->Select("*", "data");
$toReturn = array();
foreach ($datas as $data) {
$doc = new Data($data["id"]);
array_push($toReturn, self::toArray($doc));
}
return $toReturn;
}