Help with my php code sql query?

Rose

New member
<div class="content_entry">
<div class="thumbnail"></div>

<div class="entry_text">


<?php
$sql = 'SELECT * FROM books WHERE id=1';
$result = $db->query($sql);
$output[] = '<ul>';
while ($row = $result->fetch()) {
$output[] = '<li>'.'<h3>'.$row['title'].'</h3>'.$row['author'].'<br>'.'<strong>'.'Price: '.'?'.$row['price'].'</strong>'.'</li>';

$output[] = '<br /><a href="cart.php?action=add&id='.$row['id'].'">BUY <b>NOW</b></a></li>';
}
$output[] = '</ul>';
echo join('',$output);
?>




<p>Publisher : 2K Games<br>
Developer : Firaxis Games<br>
Genre : Turn-Based<br>
Mode(s) : Single player, multiplayer<br>
Release : Sep 21, 2010 </p>
<p> <strong>Availability : </strong>Usually ships within 24 hours.</p>
<p><a href=""></a></p>
<p>*</p>
</div>

<img src="Game List/Best Seller/civilization.jpg" width="121" height="159"></div>

<!-- End of Recent Reviews Entry 1 -->


<!-- Start of Recent Reviews Entry 2 -->

<div class="content_entry">
<p>*</p>
<p>*</p>
<p>*</p>
<div class="thumbnail"><img src="Game List/Best Seller/deadrising.jpg" width="121" height="159"></div>

<div class="entry_text">


<?php
$sql = 'SELECT * FROM books WHERE id=2';
$result = $db->query($sql);

while ($row = $result->fetch()) {
$output[] = '<li>'.'<h3>'.$row['title'].'</h3>'.$row['author'].'<br>'.'<strong>'.'Price: '.'?'.$row['price'].'</strong>'.'</li>';

$output[] = '<br /><a href="cart.php?action=add&id='.$row['id'].'">BUY <b>NOW</b></a></li>';

}
echo join('',$output);

?>




<p>Publisher : Capcom<br>
Developer : Blue Castle Games<br>
Genre : Horror Action Adventure<br>
Mode(s) : Single-player, online co-op, multiplayer<br>
Release : Sep 28, 2010</p>
<p><strong>Availability : </strong>Usually ships within 24 hours.</p>

</div>


-i need to get the second row data of my database in sql in the second query..but it displays the 1st and second data in my database,please correct my code.....
 
Back
Top