Example #1
0
 /**
  * Returns the article with the given id if exists
  *
  * @param $id string
  *        	the id of the article
  * @return mixed Article the requested article or null
  */
 public function get_article($id)
 {
     $query = "SELECT article.id, article.author, article.title, article.creation_date, article.change_date, article.text, user.alias FROM article ";
     $query .= "INNER JOIN user ON article.author = user.id WHERE article.id = " . $id;
     $result_article = $this->sql_con->query($query);
     $row = mysqli_fetch_assoc($result_article);
     $article = new Article($row['id'], $row['alias'], $row['title'], $this->getKeywords($row['id']), $row['text']);
     $article->set_creation_date($row['creation_date']);
     $article->set_change_date($row['change_date']);
     return $article;
 }