prepare($sql)) { $stmt->execute($val); while ($row = $stmt->fetch()) { print $row['f1'] . ' ' . $row['f2'] . "\n"; } $stmt->closeCursor(); } else { die($con->errorInfo()); } ?>