io farei così:
Codice PHP:
function getAllNews($idTB, $campoTb, $nomeTb)
{
$query = "SELECT " . $idTB . "," . $campoTb . "FROM " . $nomeTb . " ORDER BY id_news DESC";
$result = mysql_query($query, $this->db_conn) or die (mysql_error());
while ($row = mysql_fetch_row($result))
{
$row_id = $row[0];
$row_campo = $row[1];
}
return $row;
}
Codice PHP:
function titoliNews()
{
$conndb = new ConnectDB();
$conndb->db_connect();
$query = $conndb->getAllNews(id_news, titolo, tb_news);
foreach ($row as $value)
{
echo "
<a href=articolo.php>".$value."</a></p>";
}
$conndb->db_close();
}