我对着代码敲的,还是出错,不知为什么?
<?php
$page = $_GET['p'];
$host = "localhost";
$username = 'root';
$password = '';
$db = 'test';
$conn = mysql_connect($host, $username, $password);
if(!$conn){
echo "数据库连接失败";
exit;
}
mysql_select_db($db);
mysql_query('SET NAMES UTF8');
$sql = "SELECT*FROM page LIMIT".($page-1)*10 .",10";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
echo $row['id'].'-'.$row['name'];
}
?>
错误信息都不给?
limit 后面加空格
那里有错啊 来个大神指点一下
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
echo $row['id'].'-'.$row['name'];
就是这句句 有错 晕了。。。。
<?php $page = $_GET['p']; $host = "localhost"; $username = 'root'; $password = 'root'; $db = 'test'; $conn = mysql_connect($host, $username, $password); if(!$conn){ echo "数据库连接失败"; exit; } mysql_select_db($db); mysql_query('SET NAMES UTF8'); $sql = "SELECT*FROM page LIMIT".($page-1)*10 .",2"; if(!$sql){ echo "取出不成功"; }; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)){ echo $row['id'].'-'.$row['name']; } ?>