PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
DB_DataObject problem

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Database
View previous topic :: View next topic  
Author Message
Sofronisco



Joined: 30 Jul 2006
Posts: 1

PostPosted: Sun Jul 30, 2006 7:05 pm    Post subject: DB_DataObject problem Reply with quote

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
View user's profile Send private message
jhfnetboy



Joined: 21 Mar 2008
Posts: 2

PostPosted: Sat Mar 22, 2008 7:47 am    Post subject: my test Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Database All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software