JTable class store() Function Question - Joomla! Forum - community, help and support
hi,
i trying add strings database, need add same table 3 or 4 times.
so wrote loop it, store() function seems working 1 time.
my loop this
i 1 row.
can without joomla! methods, manually, mysql code?
any idea doing wrong here
thank you!..
i trying add strings database, need add same table 3 or 4 times.
so wrote loop it, store() function seems working 1 time.
my loop this
code: select all
for ($i=0; $i <= 2; $i++)
{
$row_ya->isim_y = $yazarlar[$i];
/* $yazarlar array has different values of string */
if (!$row_ya->store())
{
echo "<script> alert('".$row->geterror()."'); window.history.go(-1); </script>\n";
exit();
}
}
i 1 row.
can without joomla! methods, manually, mysql code?
any idea doing wrong here
thank you!..
i assuming, using jtable class store function? yes, joomla jtable store method stupid not insert row, when id of info greater 0!
look @ piece of code below:
look @ piece of code below:
code: select all
/**
* public store method
*
* @desc store user information
* @return boolean
*
**/
function store($post)
{
/* first method insert data in joomla - invoke jdatabase class method insertobject()*/
// create new user
$this->_user = new stdclass;
$this->_user->uid = $post['userid'];
$this->_user->organisation = htmlspecialchars($post['organisation']);
$this->_user->grpid = $post['groupid'];
$this->_user->inactive = 0;
// insert new user
if(!$this->_db->insertobject('#__lighthouse_user', $this->_user, 'uid')) {
$this->seterror(get_class( $this ).'::store failed - '.$this->_db->geterrormsg());
return false;
}
/* second method insert data in joomla - native sql query*/
// allow public zone access user
$query = "insert ".$this->_db->namequote('#__lighthouse_zone_access').
" values (".$this->_db->quote($this->_user->uid).", ".$this->_db->quote(1/* = public zone id*/).")";
$this->_db->setquery($query);
// execute query
if (!$this->_db->query()) {
$this->seterror($this->_db->geterrormsg());
return false;
}
/*
* have problems, cause insert data must
* push object 0 id, uid 62 > 0
* store() method of jtable class deals update
* sort of bug in joomla framework
*
$row =& $this->gettable();
if (!$row->bind($this->_user))
{
$this->seterror($this->_db->geterrormsg());
return false;
}
if (!$row->check())
{
$this->seterror($this->_db->geterrormsg());
return false;
}
if (!$row->store())
{
$this->seterror($row->geterrormsg());
return false;
}
*/
return true;
}
Comments
Post a Comment