diff --git a/gatewaySources.php b/gatewaySources.php new file mode 100644 index 0000000..13a5dbc --- /dev/null +++ b/gatewaySources.php @@ -0,0 +1,20 @@ +con = $con; + } + + public function addSources($sources) + { + $query = "insert into sources(link) values (:link);"; + $this->con->executeQuery($query, array(':link' => array($sources->getLink(), PDO::PARAM_STR) + ) + ); + } +} + +?> diff --git a/index.php b/index.php index d666825..08bdbe8 100644 --- a/index.php +++ b/index.php @@ -4,6 +4,7 @@ require_once("connection.php"); require_once("gatewayNews.php"); require_once("gatewayAdmins.php"); + require_once("gatewaySources.php"); $user= 'jeducourth'; $pass='achanger'; @@ -19,8 +20,11 @@ $gateNews = new GatewayNews($con); $gateNews->addNews(new News($title,$description,$pubdate,$link)); $gateAdmin = new gatewayAdmin($con); + $sources = new GatewaySources($con); $gateAdmin->addAdmin(new admin("toto","tata")); + + $sources->addSources(new sources($link)); /*$results=$gateNews->getNews(); diff --git a/sources.php b/sources.php index 78482ab..20ba9cf 100644 --- a/sources.php +++ b/sources.php @@ -1,16 +1,16 @@ lien = $lien; + $this->link = $link; } - public function getLien() + public function getlink() { - return $this->lien; + return $this->link; }