如何将while(mysql_fetch_assoc($ run))转换为PDO?

时间:2016-01-31 17:13:34

标签: php mysql pdo

while($message = mysql_fetch_assoc($run)) {
}

如何将代码转换为PDO?

谢谢!

1 个答案:

答案 0 :(得分:0)

PDO替代是PDO::FETCH_ASSOC

while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
  $data = $row."\n";
  print $data;
}