Tree - problem with the option "whereAddOn"
| From: | Tobias dot Nebel at swr dot de | Date: | Mon, 07 Jul 2003 14:00:58 +0000 |
| Subject: | Tree - problem with the option "whereAddOn" | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6518@lists.php.net to get a copy of this message | ||
Hello all!
i use the class Tree 0.2.4 with PHP 4.2.3.
my problem: when i use the option whereAddOn to use more than one tree in a
DB. but i become after the add of the first element every time errors
error adding root element: SELECT * FROM myTree WHERE 'user_id = 2' AND id=14474
error adding root element: SELECT * FROM myTree WHERE 'user_id = 2' AND id=Object
error adding root element: SELECT * FROM myTree WHERE 'user_id = 2' AND id=Object
.... and so on
every thing is ok when i use the class without the option.
my code:
$table = 'myTree';
$userID = "'user_id = ".$userID."'";
$this->tree = Tree::setup(
'Memory_DBnested',$dsn,array('table'=>$table, 'whereAddOn'=>
$userID));
$this->tree->setup();
$root = $this->makeArray('root', '');
$rootID = $this->tree->add($root);
if (PEAR::isError($rootID)) {
echo 'error adding root element: '.$rootID->getUserInfo();
}
$childOfRoot = $this->makeArray('childOfRoot', '');
$childOfRootID = $this->tree->add($childOfRoot, $rootID);
if (PEAR::isError($childOfRootID)) {
echo 'error adding root element: '.$childOfRootID->getUserInfo();
}
$childOfChild = $this->makeArray('childOfChild', '');
$childOfChildID = $this->tree->add($childOfChild, $childOfRootID);
if (PEAR::isError($childOfChildID)) {
echo 'error adding root element: '.$childOfChildID->getUserInfo();
}
function makeArray ($s, $comment)
{
return $array = array(
'name'=>$s,
'comment'=>$comment);
}
thx tobias