mysql函数语法错误[关闭]

function DisplayPoints()
{

mysql_select_db('$database');
$qry = "Select points from $this->tablename where username='$username' and password='$pwd' and confirmcode='y'";
    $rows = mysql_fetch_array($qry);
        $points = $rows['points'];
    echo " $points";

}

My idea was to make kind of points system in website. When user logins into page then in main page header you can see how much points you have.

mysql_fetch_array needs a result resource and not an SQL query. See documentation: http://php.net/manual/en/function.mysql-fetch-array.php

first get the result:

$result = mysql_query($qry);

and then fetch the array

$rows = mysql_fetch_array($result);

As Dennis pointed out, you shouldnt be using mysql_* anymore. Use PDO or mysqli_* instead.