<?php
$db = mysql_connect ("localhost","root","");
mysql_select_db("user",$db);
mysql_query("set names utf8");
$query = mysql_query("SELECT id_master FROM user WHERE login = '".$_COOKIE['login']."'", $db);
$result = mysql_fetch_assoc($query);
mysql_close($db);
$db2 = mysql_connect ("localhost","root","");
mysql_select_db("masters",$db2);
mysql_query("set names utf8");
$id_master = $result['id_master'];
$result2 = mysql_query("SELECT * FROM user WHERE login='$id_master'",$db2);
while($row=mysql_fetch_array($result2)){
$username=$row['username'];
$userfamily=$row['userfamily'];
$number=$row['number'];
$login=$row['login'];
echo "<h1>$username$userfamily</h1><br><h2>$number</h2>";
}
echo "</table>"
?>