Hello
Im trying to get my site to display all the records on the homepage that hav the catogory home.
when i display all the records in a table using
$query="SELECT * FROM news ORDER BY id DESC";
$result=mysql_query($query);
It works.
But when i try to limit using :
$page=home
$query="SELECT * FROM news WHERE category='$page' ORDER BY id DESC";
$result=mysql_query($query);
I get a blank screen.
I really dont get why it is not working.
My full script is bellow. Any help really apreciated.
<?
include("db/db.php");
$page=home
$query="SELECT * FROM news WHERE category='$page' ORDER BY id DESC";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$subject=mysql_result($result,$i,"subject");
$user=mysql_result($result,$i,"user");
$date=mysql_result($result,$i,"date");
$time=mysql_result($result,$i,"time");
$message=mysql_result($result,$i,"message");
?>
<div class="byline">
<h1><?php echo "$subject"; ?> </h1>
<div id="main-text">
<h2><?php echo "$user on $date"; ?></h2>
</div>
<div id="main-text">
<p class="style1"><?php echo "$message"; ?></p>
</div>
</div><br><br><div id="top"><br><br>
<?
$i++;
}
?>