$row["source_id"], 'name' => $row["name"], 'comment' => $row["comment"], ); } return $result; } function rec_record($source_id, $record) { global $charset,$base_path; $record = charset_pmb_normalize($record); $n_header = array(); foreach($record["header"] as $aheader_field) { switch($aheader_field["name"]) { case "rs": $n_header["rs"] = $aheader_field["value"]; break; case "ru": $n_header["ru"] = $aheader_field["value"]; break; case "el": $n_header["el"] = $aheader_field["value"]; break; case "bl": $n_header["bl"] = $aheader_field["value"]; break; case "hl": $n_header["hl"] = $aheader_field["value"]; break; case "dt": $n_header["dt"] = $aheader_field["value"]; break; default: break; } } $ref = md5(print_r($record, true)); //Suppression d'un éventuel doublon $requete="delete from entrepot_source_".$source_id." where ref='".addslashes($ref)."'"; mysql_query($requete); //Récupération d'un ID $requete="insert into external_count (recid, source_id) values('".addslashes("agnostic ".$source_id." ".$ref)."', ".$source_id.")"; $rid=mysql_query($requete); if ($rid) $recid=mysql_insert_id(); if (!$recid) return false; $date_import=date( 'Y-m-d H:i:s',time()); $ufield=""; $usubfield=""; $field_order=0; $subfield_order=0; $value=""; foreach($n_header as $hc=>$code) { $requete="insert into entrepot_source_".$source_id." (connector_id,source_id,ref,date_import,ufield,usubfield,field_order,subfield_order,value,i_value,recid) values( '".addslashes('agnostic')."',".$source_id.",'".addslashes($ref)."','".addslashes($date_import)."', '".$hc."','',0,0,'".addslashes($code)."','',$recid)"; mysql_query($requete); } for ($i=0; $irec_record($source_id, $notice); return array("notice" => $notice); } } ?>