简体   繁体   中英

Foreach key value loop (to manage PHP Object)

object(stdClass)#150 (3) {
  ["id_definicion"]=>
  NULL
  ["id_termino"]=>
  string(3) "373"
  ["definicion"]=>
  object(SimpleXMLElement)#151 (1) {
    [0]=>
    string(271) "Grupo de personas influyentes, organizado para presionar en favor de    determinados intereses. La actividad se denomina lobbying y quien la practica lobbista.<br   />Un ejemplo de lobby turístico en España es Exceltur; el Skal Club sería un lobby turístico internacional."
  }
}
object(stdClass)#151 (3) {
  ["id_definicion"]=>
  NULL
  ["id_termino"]=>
  string(3) "373"
  ["definicion"]=>
  object(SimpleXMLElement)#150 (1) {
    [0]=>
    string(119) "Vestíbulo de un hotel y de otros establecimientos como cines, teatros,   restaurantes, etc., especialmente si es grande."
  }
}

Seeing the code above I am having trouble to insert the values into my database of the second object which is inside of the first object. Im not sure how im suppose to manage an object inside another to be able to insert them.

This is the code I use to insert into the database, its very short and brief:

$db = JFactory::getDbo();

$termino = new stdClass;
$termino->id_definicion = NULL;
$termino->id_termino = $idtermino;
$termino->definicion = $definicion;

$db->insertObject( '#__csglosario_definiciones', $termino);

Thanks in advance for the help!

$ termino-> definicion =(字符串)$ definicion;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM