Hi,
I was wondering if someone could help me. I have a file called news.php:
news.php
<?
$sql = "SELECT * FROM `p_news` ORDER BY `p_id` DESC";
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_object($result))
{
$title = $row->p_title;
$content = $row->p_content;
}
?>
Then I have another file, index.php:
index.php
<?
require ("./includes/db_con.php"); //connects to DB
require ("./includes/news.php");
echo $title;
echo "<br />";
echo $content;
echo "<br /><br />";
?>
My problem is, only the first row shows up, how do I fix it? I know why its not looped, but is there a solution? I dont want to merge the two files because I plan on displaying the content from that table in more than one file, and I plan to display it differently on ever page. Is there a solution to this?
Thanks in advance
Niklas