<?
$link=mysql_connect("localhost", "root". "");
mysql_select_db("test", $link);
$q = mysql_query("select * from gkp", $link);
$link1=mysql_connect("localhost", "root". "");
mysql_select_db("gkp", $link1);
//$q = mysql_query("select * from gkp", $link);
?>
<table width="750" border="1">
<?
while($row=mysql_fetch_array($q)){
	print("
		<tr>
			<td>
				{$row['insti']}&nbsp;
			</td>		
			<td>
				{$row['pais']}&nbsp;
			</td>
			<td>
				{$row['sector']}&nbsp;
			</td>
			<td>
				{$row['pers']}&nbsp;
			</td>			
			<td>
				{$row['email']}&nbsp;
			</td>
			<td>
				{$row['web']}&nbsp;
			</td>
		</tr>
	");
	mysql_query("insert into insti(insti_nombre) values ('".$row['insti']."')", $link1);
	$id=mysql_insert_id();
	mysql_query("insert into insti_url(insti_codigo, insti_url) values ($id, '".$row['web']."')", $link1);
	mysql_query("insert into pers(pers_nombre) values ('".$row['pers']."')", $link1);
	$id1=mysql_insert_id();
	mysql_query("insert into pers_correo(pers_codigo, correo) values ($id1, '".$row['email']."')", $link1);
	mysql_query("insert into persona_clave(pers_codigo, insti_codigo) values ($id1, $id)", $link1);
	mysql_query("insert into sede(insti_codigo, pais_codigo) values ($id, ".$row['pais'].")", $link1);
	mysql_query("insert into tip_insti(insti_codigo, sector_codigo) values ($id, ".$row['sector'].")", $link1);
	
}
?>
</table>