2013-02-17 63 views
-2

为什么我的PDO提取不从表中返回任何行?PDO提取不返回表中的任何行

$sql = "SELECT * from ts_rounds WHERE current=:current"; 
    $stm = $pdo->prepare($sql); 
    $stm->execute(array(':current' => 1)); 
    $rows = $stm->fetch(); 
    echo $row["name"]; 
+1

'$行= $ STM->取(); echo $ row [“name”];'。 '$ row'和'$ rows'不是同一个变量。 – 2013-02-17 19:26:58

回答

1

把:在一号线=后:

$sql = "SELECT * from ts_rounds WHERE current=:current";