各位大侠:PHP怎样将从数据库中读取的内容生成静态HTML文件,而且能够随着数据库的更新而更新呢,帮忙解决,要源码,谢谢

解决方案 »

  1.   

    类似于这样就行了,然后将返回值打印
    function viewbanner($bid=1,$width=0,$height=0)
    {
    global $db,$table_banners;
    $query=$db->query("SELECT * FROM $table_banners WHERE bid=$bid");
    $str='';
    if($dbq_rec=$db->fetch_array($query))
    {
    if($dbq_rec['type']=='img')
    {
    $width=($width==0)?" ":"width='".$width."'";
    $height=($height==0)?" ":"height='".$height."'";
    $str.="<a target=_blanket href='".$dbq_rec['siteurl']."'>";
    $str.="<img border=0 src='".$dbq_rec['fileurl']."' alt='".$dbq_rec['subject']."' ";     $str.=$width." ".$height."></a>";
    }
    else
    {
    //            $width=($width==0)?" ":"width='".$width."'";
    $str.="<object codebase='http://download.macromedia.com/pub/shockwave/cabs/Flash/swFlash.cab#3,0,0,0' width='".$width."' height='".$height."'>";
    $str.="<param  name='SRC' value='".$dbq_rec['fileurl']."'>";
    $str.="<embed src='".$dbq_rec['fileurl']."' quality=high ";
    $str.="pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'";
    $str.=" type='application/x-shockwave-flash' width='".$width."' height='".$height."'>";
    $str.="</embed></object>";
    }
    }
    unset($query);unset($dbq_rec);
    //showmessage($str);
    return $str;
    }