carlos pascual ramos Tue Apr 05 06:53:09 -0400 2011

Subject: Two lines are inserted to save

Hi, I'm starting with PHP ActiveRecord and am trying with a simple example because two lines will always insert the same data, this is the code:
require_once dirname(FILE) . '/../../ActiveRecord.php';

class Book extends ActiveRecord\Model{}

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

$book = new Book();
$book->name = 'My first blog book!!';
$book->author = 'Carlos';
$book->save();
?>

thanks


Jan ten Bokkel Tue Apr 05 07:49:46 -0400 2011

Hi Carlos,

What do you want to do with your program?
And what is already working, do you see some newly created data in your MYSQL database?

carlos pascual ramos Tue Apr 05 08:12:31 -0400 2011

Hi Jan, I do not want anything in particular, the moment I'm experimenting with the library, but not that I'm failing to insert two lines of equal example, when really the only code is inserted.

Thanks

Jan ten Bokkel Tue Apr 05 08:16:18 -0400 2011

What error(s) does PHP show you?

carlos pascual ramos Tue Apr 05 08:18:50 -0400 2011

Shows no errors, everything is correct, only that insert two rows when you only need to insert a. That's the strange thing

Jan ten Bokkel Tue Apr 05 08:22:31 -0400 2011

And you are sure that you did run the file only once?
Because every time you run your program it will make a new entry.

carlos pascual ramos Wed Apr 06 09:45:48 -0400 2011

thanks, this solved

(1-6/6)