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为不显示
*/
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为不显示
*/
相关文章推荐
- 一个关于if else容易迷惑的问题
- PHP5.2.*防止Hash冲突拒绝服务攻击的Patch
- 深入理解PHP之匿名函数
- JSP/PHP基于Ajax的分页功能实现
- 关于PHP通过PDO用中文条件查询MySQL的问题。
- 什么是设计模式
- PHP数据库长连接mysql_pconnect的细节
- Php Installing An Expansion
- rem : web app适配的秘密武器
- jquery高级应用之Deferred对象
- 关于浮动与清除浮动,你应该知道的
- php7 读取php.ini[4]
- Mysql limit 优化,百万至千万级快速分页 复合索引的引用并应用于轻量级框架
- PHP+Apache在Windows 9x下的安装和配置
- IIS 6 的 PHP 最佳配置方法
- 安装Apache和PHP的一些补充
- Linux Apache+MySQL+PHP
- 建立Apache+PHP+MySQL数据库驱动的动态网站