Author
Title
Text
Source
';
echo '
';
}
}
}
public function getSource($id) {
$sql = "SELECT * FROM sources WHERE id = ?";
$stmt = $this->connect()->prepare($sql);
$stmt->execute([$id]);
$row = $stmt->fetch();
if($row['name'] == null) return 'No source';
else return $row['name'];
}
public function checkIfNewsIsInTrending($id) {
$sql = "SELECT * FROM trending WHERE news_id = ?";
$stmt = $this->connect()->prepare($sql);
$stmt->execute([$id]);
$row = $stmt->fetch();
if($row) return 'yes';
else return 'no';
}
}
$generateObj = new generateNews();
$generateObj->generate();
?>
';
echo ''.$author.'';
echo ''.$row['id'].'';
echo '
';
echo '';
echo ''.$title.'';
echo '
';
echo '';
echo ''.$text.'';
echo '
';
echo '';
echo ''.$source.'';
echo '
';
echo '