0

我正在使用 Php MDB2 数据抽象层并尝试使用准备/绑定将数据插入 MySql 数据库。

<?php
require_once 'MDB2-2.5.0b5/MDB2.php';

// setup
$dsn = 'mysqli://root:@localhost/propeldb';
$options = array ('persistent' => true);
$mdb2 =& MDB2::factory($dsn, $options);


$sql = 'INSERT INTO lb_attributes (attributename, addedby) VALUES  (?, ?)';

$statement = $mdb2->prepare($sql);

// figure out the data
$attribute_name = 'resolution';
$added_by = 'Hammett';

// bind the data
$statement->bindParam('attribute_name', $attribute_name);
$statement->bindParam('added_by', $added_by);

// execute and free
$statement->execute();
$statement->free();

这无济于事。你能建议我做错了什么吗?

4

0 回答 0