Adding multiselect attributes to pages in single_page

Permalink
Hello,

I'm using the okhayat'shttp://www.concrete5.org/profile/-/view/1849/... script: http://www.concrete5.org/download_file/-/17516/... adapted for my old CMS.

But finished with 99.9% the data migration i have problems with multiselect attributes.

function metadato($rec){ 
  $db = loader::db(); 
  $sql = "SELECT v.value FROM educa.valormetadato v WHERE v.id = '$rec' "; 
  $query = $db->execute($sql); 
  $row = $query->fetchRow(); 
  $dato = $row['value']; return($dato); 
} 
$audiencia1 = explode(',',trim($r['Audiencia2'])); 
foreach ( $audiencia1 as $audiencia) { 
   $audiencia = metadato(trim($audiencia)); 
} 
if (!empty($audiencia))$child->setAttribute('PORTAL_Audiencia',$audiencia); //


I need add all values in array to multiselect attribute.

Thanks :-)

madelyn