include("conn.php");$pagesize=5;
$url=$_SERVER["REQUEST_URI"];
$url=parse_url($url);
$url=$url[path];
$numq=mysql_query("SELECT * FROM `test`");
$num = mysql_num_rows($numq);if($_GET[page]){
$pageval=$_GET[page];
$page=($pageval-1)*$pagesize;
$page.=',';
}
if($num > $pagesize){
if($pageval<=1)$pageval=1;
echo "共 $num 条".
" <a href=$url?page=".($pageval-1).">上一页</a> <a href=$url?page=".($pageval+1).">下一页</a>";
}
$SQL="SELECT * FROM `test` limit $page $pagesize ";
$query=mysql_query($SQL);
while($row=mysql_fetch_array($query)){ echo "<hr><b>".$row[name]." | ".$row[sex]; }
?>我程序代码这样写了,为什么浏览器中总是这样提示:
Notice: Use of undefined constant path - assumed 'path' in D:\wamp\www\list.php on line 9Notice: Use of undefined constant page - assumed 'page' in D:\wamp\www\list.php on line 15Notice: Use of undefined constant page - assumed 'page' in D:\wamp\www\list.php on line 16
Notice: Use of undefined constant name - assumed 'name' in D:\wamp\www\list.php on line 31Notice: Use of undefined constant sex - assumed 'sex' in D:\wamp\www\list.php on line 31我是新手....求助啊 也许问题很简单...轻拍...
$url=$_SERVER["REQUEST_URI"];
$url=parse_url($url);
$url=$url[path];
$numq=mysql_query("SELECT * FROM `test`");
$num = mysql_num_rows($numq);if($_GET[page]){
$pageval=$_GET[page];
$page=($pageval-1)*$pagesize;
$page.=',';
}
if($num > $pagesize){
if($pageval<=1)$pageval=1;
echo "共 $num 条".
" <a href=$url?page=".($pageval-1).">上一页</a> <a href=$url?page=".($pageval+1).">下一页</a>";
}
$SQL="SELECT * FROM `test` limit $page $pagesize ";
$query=mysql_query($SQL);
while($row=mysql_fetch_array($query)){ echo "<hr><b>".$row[name]." | ".$row[sex]; }
?>我程序代码这样写了,为什么浏览器中总是这样提示:
Notice: Use of undefined constant path - assumed 'path' in D:\wamp\www\list.php on line 9Notice: Use of undefined constant page - assumed 'page' in D:\wamp\www\list.php on line 15Notice: Use of undefined constant page - assumed 'page' in D:\wamp\www\list.php on line 16
Notice: Use of undefined constant name - assumed 'name' in D:\wamp\www\list.php on line 31Notice: Use of undefined constant sex - assumed 'sex' in D:\wamp\www\list.php on line 31我是新手....求助啊 也许问题很简单...轻拍...
注意:使用了未定义的常量当数组的关联键未用引号括起时,php 首先检查他是否为常量,如果不是,则会产生此信息,以提醒你是否有问题由于 php 可以最大限度的调整未知量到合理的值,所以 Notice 级别的错误时可以关闭的
当关闭时,对于 $url[path]
首先检查 path 是否为常量
如果不是则认为 path是字符串,检查 $url['path'] 是否存在
如果不存在,则给出空串