I\'m just editing my search script after reading up on SQL injection attacks. I\'m trying to get the same functionality out of my script using PDO instead of a regular mysql
Take a look at the PDOStatement.fetchAll method. You could also use fetch in an iterator pattern.
Code sample for fetchAll
, from the PHP documentation:
prepare("SELECT name, colour FROM fruit");
$sth->execute();
/* Fetch all of the remaining rows in the result set */
print("Fetch all of the remaining rows in the result set:\n");
$result = $sth->fetchAll(\PDO::FETCH_ASSOC);
print_r($result);
Results:
Array
(
[0] => Array
(
[NAME] => pear
[COLOUR] => green
)
[1] => Array
(
[NAME] => watermelon
[COLOUR] => pink
)
)