Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Execute a prepared statement by passing an array of values */
- $sql = 'SELECT name, colour, calories
- FROM fruit
- WHERE calories < :calories AND colour = :colour';
- $sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
- $sth->execute(array(':calories' => 150, ':colour' => 'red'));
- $red = $sth->fetchAll();
- $sth->execute(array(':calories' => 175, ':colour' => 'yellow'));
- $yellow = $sth->fetchAll();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement