标签:
$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(); |
1
2
3
4
5
6
7
|
$sth = $dbh ->prepare(‘SELECT name, colour, calories FROM fruit WHERE calories < ? AND colour = ?‘); $sth ->execute( array (150, ‘red‘ )); $red = $sth ->fetchAll(); $sth ->execute( array (175, ‘yellow‘ )); $yellow = $sth ->fetchAll(); |
总结地址:http://www.cnblogs.com/pinocchioatbeijing/archive/2012/03/20/2407869.html
标签:
原文地址:http://www.cnblogs.com/as3lib/p/5443946.html