Hayden Robinson Tue Mar 17 21:59:34 -0400 2015

Subject: Double Record Creation

Hi, I have the following code which is producing duplicate entries into my database. ie. load the page once, and two entries, identical except for primary_keys are created.

edit    image_id    tag_id    media_file_location    generated
edit 13 12 NULL 2015-03-18 11:59:03
edit 14 12 NULL 2015-03-18 11:59:04

Hi, Im using PHP 5.4.12 on a local WAMP stack (Z-Wamp) using MYSQL and I get the duplicate records in my DB when running the below script:

========================================================================

require_once 'php-activerecord/ActiveRecord.php';

ActiveRecord\Config::initialize(function($cfg) {
$cfg->set_model_directory('models');
$cfg->set_connections(array(
'development' => 'mysql://root:@localhost/memtag'
));
});

class Image extends ActiveRecord\Model {
static $primary_key = 'image_id';
}

// Routes
if ($RequestType == "GET") {
echo "GET REQUEST";
echo "<br/><br/><br/>";
$image = new Image();
$image->tag_id = 12;
$image->save();
echo $image->image_id;
} ========================================================================