PHP分页代码
头部调用
<?
require('conn.php');
$sql1="select id from news";
$query1=mysql_query($sql1,$conn);
$sun_num=mysql_num_rows($query1);
$gs=20;
$page_num=ceil($sun_num/$gs);
include("../subpage.php");
//传过来的页数参数
$PB_page=$_GET['PB_page'];
if ($PB_page==1 or empty($PB_page)){
$a=0;
}else{
$a=(($PB_page-1)*$gs);
}
?>
HTML部分代码
<div style="margin-top:10px;" mce_style="margin-top:10px;">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
<form id="form1" name="form1" method="get" onsubmit="return checkkey()"> <tr>
<td width="9%" height="25" align="center">
<span style="color:#067098; font-weight:bold" mce_style="color:#067098; font-weight:bold">文章搜索:</span> </td>
<td width="25%" align="left"><input name="key" type="text" class="txt" id="key" size="40"/></td>
<td width="66%" align="left"><input type="submit" name="Submit" value="搜 索" /></td>
</tr>
</form>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="30" colspan="6" bgcolor="#FFFFFF" class="title" style="border-top:1px #B8D3E1 solid; border-bottom:1px #F7AC1B dashed" mce_style="border-top:1px #B8D3E1 solid; border-bottom:1px #F7AC1B dashed">新闻列表</td>
</tr>
<tr>
<td width="6%" height="25" align="center" bgcolor="#B5E9FF">ID</td>
<td width="63%" height="25" align="center" bgcolor="#B5E9FF">新闻标题</td>
<td width="8%" align="center" bgcolor="#B5E9FF">作者</td>
<td width="13%" align="center" bgcolor="#B5E9FF">添加时间</td>
<td colspan="2" align="center" bgcolor="#B5E9FF">操 作</td>
</tr>
<?
if (!$_GET[key]){
$sql="SELECT * from news order by id desc limit $a,$gs";
}else{
相关文档:
Code:
<?php
function genRandomString($len)
{
$chars = array(
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O", ......
configure: error: Unable to find libgd.(a|so)
如果使用的是ubuntu或debian就很简单了,直接sudo apt-get install apache2
libapache2-mod-php5 php5 php5-gd 就基本上搞定,但是用源代码安装还是很麻烦~
wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
tar zxvf gd-2.0.11.tar.gz
cd gd-2.0.11
sudo . ......
在线实时聊天系统,一直是一个比较麻烦的东西。
一般实现在线实时聊天,是利用JS在客户端使用ajax每隔一定的时间就返回服务器请求数据,如果有新的聊天信息则用JS呈现给用户
我们不说这样做的利弊,直接切入正题,如何来实现服务器推的在线聊天系统
首先,我先请大家看一个例子
复制代码
<?php
while(true){
&n ......
今天遇到了一个很奇怪的乱码问题,自己无意中解决了,但不知道是什么原因,只好记下来,防止以后再出现这样的问题。
当我把php语句写到下面的页面头信息之前的时候,这些php输出语句都输出的是乱码,包括用echo输出的js。如:echo "<script languge=javascript> alert('添加成功!');location.href = 'device_add.php ......