1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| function verif($name, $choicecity, $datedebut, $datefin){
$host = 'localhost';
$dbname = 'mabase';
$username = 'root';
$password = '';
$dsn = "mysql:host=$host;dbname=$dbname";
$pdo = new PDO($dsn, $username, $password);
$sql="SELECT `debut`, `fin`, `chambre` FROM reservation WHERE `choicecity`='$choicecity'";
$stmt = $pdo->query($sql);
while($row = $stmt->fetch(PDO::FETCH_ASSOC)):
$numero=($row['chambre']);
if ($numero==='') {$numero=101;
$foo = $this->rec($name, $choicecity, $datedebut, $datefin, $numero, $pdo);}
if ($numero==='101'){$numero=102;
$foo = $this->rec($name, $choicecity, $datedebut, $datefin, $numero, $pdo);}
if ($numero==='102'){$numero=103;
$foo = $this->rec($name, $choicecity, $datedebut, $datefin, $numero, $pdo);}
if ($numero==='103'){$numero=104;
$foo = $this->rec($name, $choicecity, $datedebut, $datefin, $numero, $pdo);}
if ($numero==='104'){$numero=105;
$foo = $this->rec($name, $choicecity, $datedebut, $datefin, $numero, $pdo);}
endwhile;
} |
Partager