你连问题是什么都没说怎么答??
解决方案 »
- 从mysql数据库中随机读取数据再将数据合并
- 对象元素名中含变量怎么办?
- 下拉列表怎么绑定数据啊 求代码
- 为什么我的Dreamweaver突然不能浏览了
- 怎样才能实现像dedecms那样的数据库备份呢?
- 我用PHPmailer 发生了错误请达人帮忙看下(100分送上 在线等 十万火急 答案一出立即送分)
- PHP 函数报错问题,请教!~~
- 请教关于smartTemplate 的几个简单问题!
- 是不是只有在windows下,才能用php访问access数据库?
- 用appserv配置的环境 根目录网站中文乱码 php
- php有几种方法写入mysql
- 我在网上都守侯了一天,老天爷,我的幼稚问题还没解决!!大家给点关怀吧!!!
$db->query('select ads_id from t_ads');
$db_count = $db->num_rows();
if(!$db_count) {
echo "<center>广告招商,详情请联系<a href='mailto:$admin_email?subject=关于广告招商'>$admin_email</a></center>";
exit;
}
srand((double)microtime()*1000000);
$sql = 'select * from t_ads limit '.(rand(1,$db_count)-1).',1';
@$db->query($sql) or die(数据库查询出错);
$db->next_obj();//显示广告代码开始,以下代码可以自动判断广告条格式为swf或gif
if (substr($records->ads_img,-4) == '.swf'):
?>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="468" height="60">
<param name="movie" value="images/ads/<?=$records->ads_img?>">
<param name="quality" value="high">
<param name="menu" value="false">
<embed src="images/ads/<?=$records->ads_img?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60">
</embed></object>
<?
else:
?>
<a href="<?=$records->ads_link?>" target="_blank">
<img src="images/ads/<?=$records->ads_img?>" border="0" width="468" height="60" alt="<?=$records->ads_memo?>">
</a>
<?
endif;
//判断广告显示代码结束$sql='update t_ads set ads_num='.($records->ads_num+1).' where ads_id='.$records->ads_id;
@$db->query($sql) or die ("更新数据库出错!");
?>