FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

multiple store() calls. Need new variable?

 


ptolomeo
I have the following joomla class for a component in joomla 1.0


Code:
class simpanniv_names_tbl extends mosDBTable {
   var $name_id = null;//primary key
   var $first_name_str = null;
   var $last_name_str = null;
   var $sexo = null;
   
   function simpanniv_names_tbl(&$db){
      $this->mosDBTable('#__simpanniv_names', 'name_id', $db);
   }
}



and in the part of the program that writes to the database, I have the following code:

Code:
$name_tbl = new simpanniv_names_tbl($database);

      $name_tbl->set('first_name_str',$fn1);
      $name_tbl->set('last_name_str',$ln1);
      $name_tbl->store();

      $name_tbl->set('first_name_str',$fn2);
      $name_tbl->set('last_name_str',$ln2);
      $name_tbl->store();




to write two names (fn1,ln1 and fn2,ln2) to the names table in the database.
My problem is that doing one store request after the other, it seems to me that the second one is overwriting the first one. Maybe there is a method in mosDBTable to get out from the previous row and free $name_tbl for the next store?
SamiTheBerber
So Joomla!'s mosDBTable has set function? It can't handle your new variables, because it isn't in same level. You need a new set function, which can do same, but knows if it needs to call the parent's set function.
Reply to topic    Frihost Forum Index -> Scripting -> Website Software

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.