本文整理匯總了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;
}