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']." '> ";
}

    if it doesnt have a my sql connection what do i need to add?

      because ll the stuff use a conect.php

      <?php
      parse_str("$QUERY_STRING");

      $db = mysql_connect("localhost", "removed", "removed") or die("Could not connect.");
      if(!$db)
      die("no db");
      if(!mysql_select_db("krrose27_game",$db))
      die("No database selected.");
      if(!get_magic_quotes_gpc())
      {
      $GET = array_map('mysql_real_escape_string', $GET);
      $POST = array_map('mysql_real_escape_string', $POST);
      $COOKIE = array_map('mysql_real_escape_string', $COOKIE);
      }
      else
      {

      $GET = array_map('stripslashes', $GET);
      $POST = array_map('stripslashes', $POST);
      $COOKIE = array_map('stripslashes', $COOKIE);
      $GET = array_map('mysql_real_escape_string', $GET);
      $POST = array_map('mysql_real_escape_string', $POST);
      $COOKIE = array_map('mysql_real_escape_string', $COOKIE);
      }
      ?>

        you would either include a file that is already connected to the database or make your own connection.

        Edit:
        let's say the file that I wrote for you is "ads.php"

        In ads.php you would do

        <?php
        require "conect.php";
        
        //the query will go here
        
        ?>

          just pwner it works. im gonna moddifie it a tad bit so itll conect to a certian link for a certian ad but awsome thnx dude

            I'm glad to hear it.

            Now start learning because not everyone will be as nice as me.

              yes i know this is given me a good idea on how to do these type of things

                hey harmor i got around to playin with it today and i added another add and it tryed to show both. is their a way to make it randomly select one?

                <?php 
                		require "connect.php";
                		 $getads = mysql_query("SELECT * FROM km_ads WHERE ad_id ")or die(mysql_error());
                		while($ads = mysql_fetch_array($getads))
                		{
                		echo "<a href=' ".$ads['ad_link']." '><img src=' ".$ads['ad_path']." '></a> ";
                		} ?>
                  <?php 
                  require "connect.php";
                  
                       $getads = mysql_query("SELECT * FROM km_ads WHERE ad_id ORDER BY RAND() ")or die(mysql_error());
                      while($ads = mysql_fetch_array($getads))
                      {
                      echo "<a href=' ".$ads['ad_link']." '><img src=' ".$ads['ad_path']." '></a> ";
                      } 
                  
                  ?> 

                  Notice the ORDER BY RAND()

                    Write a Reply...