I'm trying to set up an article system for a site I'm working on. I'll use the review articles as an example.
Each review page has the following:
Game Title (game)
Game Image (gameimage)
Author (author)
Review (review)
Basically, I'm trying to figure out a way to do pages so that when I call, for example:
http://www.inisfail.com/warroom/reviews.php?game=Warhammer
I only get the information pertaining to the row that contains the field game equal to "Warhammer".
At this point, I'm pulling data from all reviews entered in the database. Any way to get around this?
Here's the code I'm using:
<?php
$pagetitle="Review of $game";
include 'header.php';
?>
<?php
$sqlquery = "SELECT * FROM twr_reviews";
// get the info for game reviews
$result = mysql_query($sqlquery);
$number = mysql_numrows($result);
$i = $number - 1;
while($i>-1) {
$title = mysql_result ($result,$i,"title");
$gametitle = mysql_result ($result,$i,"game");
$author = mysql_result ($result,$i,"author");
$review = mysql_result ($result,$i,"review");
$gameimage = mysql_result ($result,$i,"gameimage");
if ($gametitle = $game) {
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%" >
<tr>
<td width="100%">
<h2 align="center"><?php echo $title ?></h2>
<?php
echo "<h3 align=\"center\">A Review of $game</h3>"
?>
</td>
</tr>
<tr>
<?php
echo "<td width='100%'><img border='0' src='$gameimage' align='right'><b>Reviewed by:</b> $author<p>$review</td>"
?>
</tr>
</table>
<?php
}
$i = $i - 1;
}
?>
<?php
include 'footer.php'
?>