I need to get the photo with the second highest salary
<?php
$host = "localhost";
$username = "root";
$password = "";
$db = "imagem";
mysql_connect($host,$username,$password) or die("Impossível conectar ao banco.");
@mysql_select_db($db) or die("Impossível conectar ao banco");
$img=mysql_query("SELECT * FROM arquivo WHERE sal < (SELECT MAX(sal)FROM arquivo)") or die("Impossível executar a query");
while($row=mysql_fetch_object($img)) {
echo "<img src='getImagem.php?PicNum=$row->codigo' \">";
}
?>