amadeus93lee
New member
I need to first get data from a mysql database, but the problem comes when I try to retrieve the data, and filter it out. I only want articles in section1, category 1 to appear on this page, but I don't know how to filter those out from all the others. Here is my existing code so far. If some of it looks broken up, that is because of formatting I did to it so it could fit into this column...
<?php
$query="SELECT * FROM content";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$title=mysql_result
($result,$i,"title");
$date=mysql_result
($result,$i,"date");
$creator=mysql_result
($result,$i,"creator");
$intro=mysql_result
($result,$i,"intro");
$body=mysql_result
($result,$i,"body");
$published=mysql_result
($result,$i,"published");
$access=mysql_result
($result,$i,"access");
echo "<b>$title</b><br>$intro<br>$body
<br>Created by $creator on $date<hr><br>";
$i++;
}
?>
<?php
$query="SELECT * FROM content";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$title=mysql_result
($result,$i,"title");
$date=mysql_result
($result,$i,"date");
$creator=mysql_result
($result,$i,"creator");
$intro=mysql_result
($result,$i,"intro");
$body=mysql_result
($result,$i,"body");
$published=mysql_result
($result,$i,"published");
$access=mysql_result
($result,$i,"access");
echo "<b>$title</b><br>$intro<br>$body
<br>Created by $creator on $date<hr><br>";
$i++;
}
?>