0

我正在尝试设置分页,但是有一个烦人的数据库连接错误。你能帮我一把吗?谢谢!

<?php
        include('includes/db_AF.php'); //includes the db credentials
        $connection = @new mysqli(HOSTNAME, MYSQLUSER, MYSQLPASS, MYSQLDB);
        if ($connection->connect_error) {
        die('Connect Error: ' . $connection->connect_error);
        }
        else {

if (!(isset($pagenum))) 
{ 
$pagenum = 1; 
} 


 $data = "SELECT * FROM wordtable2"; 
$data1 = mysql_query($data);
 $rows = mysql_num_rows($data1);

这是错误消息:警告:mysql_query():用户''@'localhost'(使用密码:NO)的访问被拒绝

4

1 回答 1

0

如果您使用mysqli库进行连接,请使用它进行查询:

$result = mysqli_query($connection_obj, $query); 
$count = mysqli_num_rows($result)
于 2013-10-15T11:14:54.760 回答