Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1. <?php
  2. /* Execute a prepared statement by passing an array of values */
  3. $sql = 'SELECT name, colour, calories
  4.    FROM fruit
  5.    WHERE calories < :calories AND colour = :colour';
  6. $sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
  7. $sth->execute(array(':calories' => 150, ':colour' => 'red'));
  8. $red = $sth->fetchAll();
  9. $sth->execute(array(':calories' => 175, ':colour' => 'yellow'));
  10. $yellow = $sth->fetchAll();
  11. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement