Okay, so obviously the code I have now doesn't work
$stmt = $pdo->prepare('SELECT * FROM '.$table.' WHERE id = :p');
foreach($stmt->execute(array(':p' => $_GET['p'])) as $row) {
echo $row['id'];
}
but, hopefully you can understand what I'm trying to do. I want to return values from an sql entry that are related to id whatever. I'm not exactly sure what combination of prepare, execute, or query I need to use to achieve this.
Thanks
execute()returns true or false, not an array. You just call$stmt->fetch(PDO::FETCH_ASSOC)in a while loop, or$stmt->fetchAll()to get an array. php.net/manual/en/pdostatement.fetch.php