vinpkl Posted February 15, 2009 Share Posted February 15, 2009 hi all i have 50 products and want to show 4 at a time and shuffle them on manual refresh. like serial 1 to 4 , then serial 4 to 8, then serial 8 to 12, then 12 to 16. i have used rand() function and it displays results by its own. not serial wise. how is it possible. this is my code <?php echo "<table>"; echo "<tr>"; $qry1="select * from product_table where category_id=1 and status='Y' ORDER BY RAND() LIMIT 0,4"; $result1 = mysql_query($qry1); if(mysql_num_rows($result1)>0) { while($row1=mysql_fetch_array($result1)) { echo "<td width=148 valign=top>"; echo "<table>"; echo "<tr>"; echo "<td valign=top width=125>". $row1['product_name'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td valign=top>". $row1['description'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td valign=top class=cut>". "NZ$ " . $row1['cutout_price'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td valign=top class=price>". "NZ$ " . $row1['price'] . "</td>"; echo "</tr>"; echo "</table>"; echo "</td>"; } } echo "</tr>"; echo "</table>"; ?> vineet Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.