对着敲的,还是出错,贴出代码
我对着代码敲的,还是出错,不知为什么?
<?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'];
}
?>