 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
Sofronisco
Joined: 30 Jul 2006 Posts: 1
|
Posted: Sun Jul 30, 2006 7:05 pm Post subject: DB_DataObject problem |
|
|
Hi all.
I have Setup DB_DataObject and it created all the classes.
I have used it with db_dataobject_formbuilder and it dispays all the forms.
But it does not insert or update tables.
In fact if i try to do an update() it does not work:
| Code: |
define( "DB_DATAOBJECT_NO_OVERLOAD", TRUE );
require_once 'DB/DataObject.php';
require_once 'DB/DataObject/FormBuilder.php';
$config = parse_ini_file('db_dataobject.ini',TRUE);
foreach( $config as $class => $values )
{
$options = &PEAR::getStaticProperty( $class, 'options' );
$options = $values;
}
$tmp =& DB_DataObject::factory('Public_table');
$tmp->get(1);
$tmp->myfield = 'hello';
$tmp->update();
|
PHP 4.4.2
DB_DataObject 1.8.4 stable
Thank you in advance |
|
| Back to top |
|
 |
jhfnetboy
Joined: 21 Mar 2008 Posts: 2
|
Posted: Sat Mar 22, 2008 7:47 am Post subject: my test |
|
|
where do you want to insert or update?on form to submit?
i try this code and it works well,submit is ok:
| Code: |
<?php
require_once('DB/DataObject/FormBuilder.php');
//建立数据库链接
$config = parse_ini_file('DB/DataObject/myconfig.ini',TRUE);
foreach($config as $class=>$values) {
$options = &PEAR::getStaticProperty($class,'options');
$options = $values;
}
//创建表对象,load对应目录的class
$T_Product=& DB_DataObject::factory('T_Product');
//使用DB的formbuilder自动创建form
$formBuilder =& DB_DataObject_FormBuilder::create($T_Product);
$form =& $formBuilder->getForm();
if($form->validate()) {
$form->process(array(&$formBuilder, 'processForm'), true);
//详细参数请参考help文档
$form->freeze();
}
//显示form
echo $form->toHtml();
?>
|
if you want to update in code,i will try later:) |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|