本文整理汇总了PHP中Connexion::Requete方法的典型用法代码示例。如果您正苦于以下问题:PHP Connexion::Requete方法的具体用法?PHP Connexion::Requete怎么用?PHP Connexion::Requete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connexion
的用法示例。
在下文中一共展示了Connexion::Requete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update()
{
$connexion = new Connexion();
$sql = "";
$sql = "UPDATE \"libertribes\".\"CASE\" set coord = '" . $this->coord . "', occupee_par = '" . $this->occupee_par . "', occupant_id = '" . $this->occupant_id . "', nom_terrain = '" . $this->nom_terrain . "' ";
$sql .= "WHERE id = '" . $this->id . "'";
return $connexion->Requete($sql);
}
示例2: Connexion
function __construct($row)
{
$this->lien_regles = "http://wiki.hegoa.eu/Personnage";
if (!is_array($row)) {
// - on établit une connexion car on n'a pas transmis de données venant déjà de la BDD; la variable row est soit l'ID de l'avatar soit le nom (qui doit être unique)
$connexion = new Connexion();
// premier test, sur l'ID
$sql = "SELECT * FROM \"libertribes\".\"AVATAR\" WHERE avatar_id = '" . $row . "'";
$result = $connexion->Requete($sql);
if (isset($result) && !empty($result)) {
$num_rows = pg_num_rows($result);
while ($row = pg_fetch_array($result)) {
$this->id = $row['avatar_id'];
$this->nom = $row['avatar_nom'];
$this->date_creation = $row['date_creation'];
$this->agressivite = $row['niveau_agressivite'];
$this->efficacite = $row['niveau_efficacite'];
$this->commerce = $row['niveau_commerce'];
$this->escroquerie = $row['niveau_escroquerie'];
$this->compte_id = $row['compte_id'];
$this->race = $row['race'];
$this->niveau = $row['niveau'];
$this->num_image = $row['numero_image'];
$this->derniere_position = $row['derniere_position'];
$this->derniere_connexion = $row['derniere_connexion'];
$this->histoire = $row['histoire'];
}
}
if (!isset($num_rows) || !$num_rows || $num_rows == 0) {
// deuxième test, sur le nom
$sql = "SELECT * FROM \"libertribes\".\"AVATAR\" WHERE avatar_nom = '" . $row . "'";
$result = $connexion->Requete($sql);
if (isset($result) && !empty($result)) {
while ($row = pg_fetch_array($result)) {
$this->id = $row['avatar_id'];
$this->nom = $row['avatar_nom'];
$this->date_creation = $row['date_creation'];
$this->agressivite = $row['niveau_agressivite'];
$this->efficacite = $row['niveau_efficacite'];
$this->commerce = $row['niveau_commerce'];
$this->escroquerie = $row['niveau_escroquerie'];
$this->compte_id = $row['compte_id'];
$this->race = $row['race'];
$this->niveau = $row['niveau'];
$this->num_image = $row['numero_image'];
$this->derniere_position = $row['derniere_position'];
$this->derniere_connexion = $row['derniere_connexion'];
$this->histoire = $row['histoire'];
}
}
}
} else {
// on a transmis des données venant déjà de la BDD; la variable row est un tableau contenant les champ de l'avatar
$this->id = $row['avatar_id'];
$this->nom = $row['avatar_nom'];
$this->date_creation = $row['date_creation'];
$this->agressivite = $row['niveau_agressivite'];
$this->efficacite = $row['niveau_efficacite'];
$this->commerce = $row['niveau_commerce'];
$this->escroquerie = $row['niveau_escroquerie'];
$this->compte_id = $row['compte_id'];
$this->race = $row['race'];
$this->niveau = $row['niveau'];
$this->num_image = $row['numero_image'];
$this->derniere_position = $row['derniere_position'];
$this->derniere_connexion = $row['derniere_connexion'];
$this->histoire = $row['histoire'];
}
// on charge tous les villages de l'avatar, ainsi que toutes les autres cases occupées
if (!isset($connexion)) {
$connexion = new Connexion();
}
$villages = array();
$i = 0;
$sql = "SELECT * FROM \"libertribes\".\"VILLAGE\" WHERE avatar_iden = '" . $this->id . "'";
$result = $connexion->Requete($sql);
if (isset($result) && !empty($result)) {
while ($row = pg_fetch_array($result)) {
$villages[$i] = new Village($row['village_id']);
$i++;
}
}
$mes_cases = array();
$i = 0;
$sql = "SELECT * FROM \"libertribes\".\"CASE\" WHERE occupant_id = '" . $this->id . "'";
$result = $connexion->Requete($sql);
if (isset($result) && !empty($result)) {
while ($row = pg_fetch_array($result)) {
$mes_cases[$i] = new Caza($row);
$i++;
}
}
$this->villages = $villages;
$this->mes_cases = $mes_cases;
$this->calculProductionVillages();
$this->calculManaTotal();
}
示例3: obtenirTauxNatalite
private function obtenirTauxNatalite($avatar_id)
{
$connexion = new Connexion();
$sql = "SELECT race FROM \"libertribes\".\"AVATAR\" WHERE avatar_id = " . $avatar_id;
$result = $connexion->Requete($sql);
if (isset($result) && !empty($result)) {
$row = pg_fetch_row($result);
$larace = $row[0];
}
// les races sont déjà mises en SESSION, dans $_SESSION['races_possibles']
foreach ($_SESSION['races_possibles'] as $race) {
if ($larace == $race->nom) {
$this->natalite = $race->taux_natalite;
break;
}
}
}
示例4: Connexion
function __construct($row)
{
if (!is_array($row)) {
// - on établit une connexion car on n'a pas transmis de données venant déjà de la BDD; la variable row est soit l'ID du compte du joueur soit l'email (qui doit être unique)
$connexion = new Connexion();
// premier test, sur l'ID
$sql = "SELECT * FROM \"libertribes\".\"COMPTE\" WHERE compte_id = '" . $row . "'";
$result = $connexion->Requete($sql);
if (isset($result) && !empty($result)) {
$num_rows = pg_num_rows($result);
while ($row = pg_fetch_array($result)) {
$this->id = $row['compte_id'];
$this->nom = $row['nom'];
$this->prenom = $row['prenom'];
$this->password = $row['password'];
$this->email = $row['email'];
$this->date_inscription = $row['date_inscription'];
$this->confirmation = $row['confirmation'];
$this->ville = $row['ville'];
$this->pays = $row['pays'];
$this->date_anniv = $row['date_anniv'];
$this->presentation = $row['presentation'];
$this->statut = $row['statut'];
$this->type_compte = $row['type_compte'];
}
}
if (!isset($num_rows) || !$num_rows || $num_rows == 0) {
// deuxième test, sur l'email
$sql = "SELECT * FROM \"libertribes\".\"COMPTE\" WHERE email = '" . $row . "'";
$result = $connexion->Requete($sql);
if (isset($result) && !empty($result)) {
while ($row = pg_fetch_array($result)) {
$this->id = $row['compte_id'];
$this->nom = $row['nom'];
$this->prenom = $row['prenom'];
$this->password = $row['password'];
$this->email = $row['email'];
$this->date_inscription = $row['date_inscription'];
$this->confirmation = $row['confirmation'];
$this->ville = $row['ville'];
$this->pays = $row['pays'];
$this->date_anniv = $row['date_anniv'];
$this->presentation = $row['presentation'];
$this->statut = $row['statut'];
$this->type_compte = $row['type_compte'];
}
}
}
} else {
// on a transmis des données venant déjà de la BDD; la variable row est un tableau contenant les champ de l'avatar
$this->id = $row['compte_id'];
$this->nom = $row['nom'];
$this->prenom = $row['prenom'];
$this->password = $row['password'];
$this->email = $row['email'];
$this->date_inscription = $row['date_inscription'];
$this->confirmation = $row['confirmation'];
$this->ville = $row['ville'];
$this->pays = $row['pays'];
$this->date_anniv = $row['date_anniv'];
$this->presentation = $row['presentation'];
$this->statut = $row['statut'];
$this->type_compte = $row['type_compte'];
}
}