4,251
社区成员
发帖
与我相关
我的任务
分享
public PDOStatement executePrepared(PDOStatement $statement, array $placeholders, array $dataTypes
);
这里的$dataTypes是什么?例子里面只传了两个参数啊
public PDOStatement prepare (string $sqlStatement)
//Returns a PDO prepared statement to be executed with ‘executePrepared’
$statement = $db->prepare(’SELECT * FROM robots WHERE name = :name’);
$result = $connection->executePrepared($statement, array(’name’ => ’Voltron’));
public PDOStatement executePrepared (PDOStatement $statement, array $placeholders, array $dataTypes)
//Executes a prepared statement binding. This function uses integer indexes starting from zero
但是他这里的示例executePrepared只传了两个参数,但是定义里面是有三个参数的,array $dataTypes是必传单数,想知道这个$dataTypes是啥$connection = new \Phalcon\Db\Adapter\Pdo\Mysql(array(
"host" => "localhost",
"username" => "root",
"password" => "",
"dbname" => "test"
));
//print_r(get_class_methods($connection)); //从支持的方法上看,只不过是在PDO上扩展了一些功能
$connection->query('set names gbk');
$t = $connection->fetchAll('select * from `123`', 1);
print_r($t);
Array
(
[0] => Array
(
[id] => 1
[姓名] => 张三
[型号] => A8-300
[工位] => A
[数量] => 200
[时间] => 2013-06-05 08:46:00
)
[1] => Array
(
[id] => 2
[姓名] => 李四
[型号] => A8-300
[工位] => B
[数量] => 121
[时间] => 2013-06-05 08:48:00
)
[2] => Array
(
[id] => 3
[姓名] => 王五
[型号] => A1-200
[工位] => C
[数量] => 45
[时间] => 2013-06-05 07:48:00
)
[3] => Array
(
[id] => 4
[姓名] => 张三
[型号] => A8-300
[工位] => A
[数量] => 420
[时间] => 2013-06-05 10:46:00
)
[4] => Array
(
[id] => 5
[姓名] => 王五
[型号] => A8-300
[工位] => C
[数量] => 500
[时间] => 2013-06-05 13:46:00
)
)
我这个表很怪异吧$t = $connection->fetchAll('select * from `123`', 1);