| Current Path : /home/wirbesti/public_html/php/ |
| Current File : /home/wirbesti/public_html/php/Canton.php |
<?php
class Canton
{
private $con;
// Database Connection
public function __construct(DBConnection $database)
{
$this->con = $database;
return $this->con;
}
public function getCantonbyZip(string $zip)
{
$query = "SELECT `plz`, `kanton` FROM `nvbjn_zipcanton` z ".
"WHERE z.plz = :plz;";
$getcanton = $this->con->dbc->prepare($query);
$getcanton->bindParam(':plz', $zip);
$getcanton->execute();
$result = $getcanton->fetch();
if ($result) {
return $result;
} else {
echo "Record not found";
}
}
}
?>