user2608564
user2608564

Reputation: 29

How can I convert mysql_fetch_assoc to PDO?

$result = $db->("SELECT `count` FROM playerCount");
while($row = mysql_fetch_assoc($result)) {
      echo $row['count'];
}

How can I convert line: while($row = mysql_fetch_assoc($result)) {

to PDO?

Thanks.

Upvotes: 1

Views: 2814

Answers (1)

Bill Karwin
Bill Karwin

Reputation: 562731

$stmt = $db->query(...);
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {

Upvotes: 4

Related Questions