Page 1 of 1

echo the smallest id from a $row result

Posted: Fri Apr 24, 2015 7:38 am
by floryn

Code: Select all

<div id="poze">
<?php 

    $img_url = "http://fiestukis.site40.net/"; 
    $result = mysql_query("SELECT url FROM  images  where sid='$sid' Order by ID DESC limit 7 "); 
    while($row = mysql_fetch_assoc($result)) 
    { 
        echo '<img src="'.$img_url.$row['url'].'" border="0"  width="200" height="250" />';

    }
$num_rows = mysql_num_rows($result);

echo "$num_rows Rows\n";

?>
</div>
I have this code to list the photos stored in my data base. how do I echo out the id of each photo that shows and how do I echo the smallest id from the 7 results

Re: echo the smallest id from a $row result

Posted: Sat Apr 25, 2015 3:56 am
by KyleMassacre
You can probably just do something like using the min() function