I am assuming that you are putting this in a script that already has a connection to your database.
First what you want to do is make the query
$getads = mysql_query("SELECT * FROM km_ads WHERE ad_id ")or die(mysql_error());
while($ads = mysql_fetch_array($getads))
What this is doing is selecting values from the table "km_ads" and the "WHERE" clause isn't really needed but I put it there out of habit.
the "while" loop will get everything from the table.
now you'll want to get the results
{
echo "<img src=' ".$ads['ad_path']." '>";
}
What this is doing is getting the value from the field "ad_path" (which would be the path to your image) and inserting into an image tag.
(the curly brackets is for the "while loop", everything in these curly brackets will be displayed until it can't retrieve anymore results
To put it all together
$getads = mysql_query("SELECT * FROM km_ads WHERE ad_id ")or die(mysql_error());
while($ads = mysql_fetch_array($getads))
{
echo "<img src=' ".$ads['ad_path']." '> ";
}