将PDO语句结果设置为每个字段的变量

I have this PDO Statement, How do i set the results into variables for another use. Ie. I want PName, Player_price and Player_Points as PHP Variables. Someone please help me.

if ($stmt = $con->prepare("SELECT PName, Player_price, Player_points, Total_points FROM Keepers_points WHERE 'WeekNo'=? && 'PlayerNO'=?")) 
    {
    $stmt->bind_param("dd", $Week_ID, $GK_2 );
    $stmt->execute();

You have to fetch your statement into an associative array (or something else) then use it. You have errors in your SQL and your php too please check below

  1. in your SQL you shouldn't surround column names by ' at the place use backticks `
  2. bindParam as it name says, it is used to bind 1 parameter at a time, so in your code you have to use 2 bindParam lines, one for each parameter, or create an array with the variables you want to pass to your prepared statement and pass this array to execute as I did in my code.

    if ($stmt = $con->prepare("SELECT PName, Player_price, Player_points, Total_points FROM Keepers_points WHERE `WeekNo`=? AND `PlayerNO`=?")) 
    {
        $data=array($Week_ID, $GK_2);
        $stmt->execute($data);
        $stmt->setFetchMode(PDO::FETCH_ASSOC);
        while($array=$stmt->fetch()){
            print_r($array);
        }
    }
    

Or you can use fetchAll() to have all the results into an array

if ($stmt = $con->prepare("SELECT PName, Player_price, Player_points, Total_points FROM Keepers_points WHERE `WeekNo`=? AND `PlayerNO`=?")) 
{
    $data=array($Week_ID, $GK_2);
    $stmt->execute($data);
    $array=$stmt->fetchAll();
    print_r($array);
}

Check the manual for more options: http://www.php.net/manual/en/

SIDE NOTE: it is better to use AND not && as that's the standard SQL