Php MDB2 prepared statements not working

246 Views Asked by At

I am using Php MDB2 data abstraction layer and trying insert data into the MySql database using prepare/bind.

<?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();

This does nothing. Can you suggest what wrong am I doing.

0

There are 0 best solutions below