@Open,
Awesome! Thanks for snippet. Once a bit deeper, I’ll relay feedback.
However, regarding:
Quote from: pixelchutes at Jan 23, 2007, 04:23 AM
I couldn’t test the Person example on xPDO site per lack of table/class/map files. So, I created the table and the class, and as I looked at the map file, I realized I hadn’t created a table for the Person example, rather the xpdosample table... So, I needed to adjust the person example to match that of my table/map file...
here is the example I am setting: (using the example xpdosample class/map files + manually created table w/ map file as reference)
<?php
$sample= $xpdo->newObject('xpdosample');
$sample->set('parent', null );
$sample->set('unique_varchar', 'row_one');
$sample->set('varchar', 'hello world');
$sample->set('text', 'xPDO Sample');
$sample->set('timestamp', date('H:i:s'));
$sample->set('unix_timestamp', time );
$sample->set('date_time', date('Y-m-d H:i:s'));
$sample->set('date', date('Y-m-d'));
$sample->set('enum', 'T');
$sample->set('password', md5('password'));
$sample->set('integer', 13);
$sample->set('boolean', 1);
$sample->save();
...and the CREATE TABLE I used...
CREATE TABLE `xpdosample` (
`parent` int(11) default NULL,
`unique_varchar` varchar(255) NOT NULL,
`varchar` varchar(100) NOT NULL,
`text` text,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`unix_timestamp` int(11) NOT NULL,
`date_time` datetime NOT NULL,
`date` date NOT NULL,
`enum` enum('','T','F') NOT NULL,
`password` varchar(255) NOT NULL,
`integer` int(11) NOT NULL,
`boolean` binary(1) NOT NULL,
UNIQUE KEY `unique_varchar` (`unique_varchar`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='My first xPDO Test ;)'
All works (connection established, etc) until I uncomment the save() method.
Error indicates a missing driver?
Fatal error: Uncaught exception ’PDOException’ with message ’could not find driver’ in /home/username/public_html/xpdo/xpdo.class.php:293 Stack trace: #0
Hmm..looks like it’s the
connect method for xPDO-class, and doesn’t like this line:
<?php
$this->pdo= new PDO($this->config['dsn'], $this->config['username'], $this->config['password'], $this->config['driverOptions']);
Hmm, well, I’m runnin PHP 5.1.6, is it possible that PDO isn’t available to me? I’ll see if I can confirm...
phpinfo() revealed:
PDO support enabled
PDO drivers sqlite2
Well,
on the php.net PDO page, it states that if on PHP 5.1+ (which I am) PDO and PDO_SQLITE are included in the distribution, and are automatically enabled by running configure...Also, You may also need to enable the PDO driver for your database of choice:
[*] PDO Drivers:
http://www.php.net/manual/en/ref.pdo.php#pdo.drivers (Reference MySQL 3.x and 4.x )
Oh no! I am running MySQL 5.0.27-standard!
Can I still use xPDO?