samedi 27 août 2016

How to dispaly the three biggest numbers of one of the columns of a database table?

I have to write a php script to find the three biggest numbers of a column in a database table. This is my code so far, but it doesn't work .

<?php
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("pool");

 $res1=mysql_query("SELECT * FROM buy ORDER BY value LIMIT 3 ");

 while($r1=mysql_fetch_array($res1)){
     echo $r1['value']; 
  }
?>

Aucun commentaire:

Enregistrer un commentaire