I want to call 2 column from DB newsId and title and then print it.
My code looks like this:
class edit
{
private $db;
public function __construct()
{
$this->db = new Connection();
$this->db = $this->db->dbConnect();
}
public function news($neswID, $title)
{
$sql = $this->db->prepare("SELECT newsID, title FROM `news`");
$result = $sql->execute(array($newsID, $title));
while ($sql->fetch($result)) {
print $neswID . '<br>' . $title;
}
}
}
and I call this class like this:
include_once "test.php";
$object= new edit();
$object->news($newsID, $title);
I am really new, thank you for help.