您的位置:首页 > 编程语言 > PHP开发

php学习 left.php

2016-07-07 18:36 423 查看
<script language="javascript">

function chkinput(form){

if(form.content.value==""){
alert("请输入查询关键字!");
form.content.select();
return false;
}

}

function opengg(id){
window.open("showgg.php?id="+id,"","width=679,height=443");
}

</script>

<?php

include("conn/conn.php");
include("JS/function.php");
$gsql=mysql_query("select * from tb_advertising where flag=1 order by id desc limit 0,10",$conn);

$ginfo=mysql_fetch_array($gsql);
if($ginfo==false){

alert("暂无消息!");
}else{
do{

echo msubstr($ginfo[title],0,30);
if(strlen($ginfo[title]) > 30){
echo "...";
}
}while($ginfo=mysql_fetch_array($gsql));
}

?>

    /*
*window.open(pageURL,name,parameters)

  *pageURLA为子窗口路径

     *name 为子窗口句柄
*parameters为窗口参数(各参数用逗号分隔)
*/

/*
*order by id desc limit 10 按照id的倒序排序 取出前10条
*order by id desc limit 0,10 按照id的倒序排序 取出前10条
*order by id desc limit 5,10 按照id的正常排序 从第5条开始取出10条
*
*/

/*
*msubstr($str,$start=0,$length,$charset="utf-8",$suffix=true)
*$str要截取的字符串
*$start=0:开始位置,默认从0开始
*$length:截取长度
*$charset="utf-8":字符编码,默认UTF-8
*$suffix=true:是否在截取后的字符后面显示省略号,默认true显示,flase为不显示
*/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息