Skip to content

Санамсаргүйгээр баннер харуулах

November 1, 2006

Вэбсофт Монгол ХХК-ын вэб боловсруулах программын эх кодыг та бүхэнд танилцуулж байна.
function  random_show($show_type , $page_type , $show_db, $show_banner_num)
   {
    //$show_type  *******************
  $big_bottom_banner=”No banner”;
  $query = “SELECT  * FROM $show_db “;
  //echo “<br> Query–“.$query ;
  $result = mysql_query ($query) or die (“Query failed”);

  $result_num=mysql_num_rows($result);
  //echo “Result number:  “.$result_num;

   while ($row = mysql_fetch_array($result, MYSQL_NUM))
      {
         //  printf (“ID: %s  Name: %s<br>”, $row[0], $row[1]);
      $banners[]=$row;
     }

 srand ((float) microtime() * 10000000);
 $rand_keys = array_rand ($banners,   $show_banner_num );
    for($i=1;   $i  < $show_banner_num; $i++)
    {  // for banner number sss
                   switch($show_type){     
     case ‘img’ :
     list($id, $folderid, $pic, $mnname, $enname, $ddate) = $banners[$rand_keys[$i]];
     $image =  “зургийн байрлал/”.$pic;
     $heigth_width=get_image_size1($image,100,100);
     echo “<a href=’index.php?page_type=$page_type&gallery=4&g=$id&folderid=$folderid’>
     <img src=’зургийн байрлал/$pic’ “.$heigth_width.” border=0></a><br>”;
         echo $mnname;
         echo “<br>”;
         echo $ddate;
        break;
        } // switch eee
  }
       
 } // function haalt

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: