来个大神指点一下
那里有错啊 来个大神指点一下
$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'];
}
?>