Created
March 21, 2013 18:55
-
-
Save rantastic/5215649 to your computer and use it in GitHub Desktop.
PHP: PDO select statement return array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$stmt = $db->prepare('SELECT * FROM tablename WHERE colname = ?'); | |
$stmt->execute(array($variable)); | |
$results = $stmt->fetchAll(PDO::FETCH_ASSOC); | |
if($stmt->rowCount()>0){ | |
foreach($results as $result){ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment