Jump to content

[SOLVED] SELECT TOP 3 problem


Sorrow

Recommended Posts

Hi everyone. I need to display only the top 3 items of the query when i do this

<?php

include 'opendb.php';

$query  = "SELECT * FROM reviews Order by m_index DESC ";
$result = mysql_query($query);

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
    echo "<a href='/moviereview.php?index={$row['m_index']}'>{$row['m_Title']}</a><br>";

}
mysql_close($con);

?>

 

its ok it displays every entry but I only need the top 3 and I tried

SELECT TOP 3 * FROM reviews Order by m_index DESC
and 
SELECT TOP 3 FROM reviews Order by m_index DESC

 

Any idea what am I doing wrong???

Link to comment
https://forums.phpfreaks.com/topic/125390-solved-select-top-3-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.