--create table Org ( Id number(9) not null primary key, Name varchar(80) not null,TIN decimal(10) unique, Note varchar(4000), unique (Name, TIN) );
--create table Person ( Id number(9) not null primary key, Name_0 varchar(26), Name_1 varchar(26), Name_2 varchar(26), Native_Lang char(2) not null, Another_Lang_2 char(2), Another_Lang_3 char(2), check (Native_Lang != Another_Lang_2 and Native_Lang != Another_Lang_3 and Another_Lang_2 != Another_Lang_3) );
--create table Contact ( Org_Id references Org not null, Person_Id references Person not null, Position varchar(40), Note varchar(2000), primary key (Org_Id, Person_Id) );
--drop view MultyContactPersonnel;
create view MultyContactPersonnel as
select Person_Id as Id, (select Name_0 from Person where Id=c.Person_Id) as Name_0,
(select Name_1 from Person where Id=c.Person_Id) as Name_1,
(select Name_2 from Person where Id=c.Person_Id) as Name_2,
Org_Id as Org_Name, Position as Contact_Position, Note as Contact_Note,
(select count(DISTINCT Native_Lang)+count(DISTINCT Another_Lang_2)+count(DISTINCT Another_Lang_3)
from Person where Id=c.Person_Id) as Lang_Count
from Contact c
where Person_Id in (
select Id
from Person p
where (Native_Lang='ru' or Another_Lang_2='ru' or Another_Lang_3='ru') and
(select count(*) from Contact where Person_Id=p.Id) >1
)
--insert into Org values(1,'1',1,'1');
--insert into Org values(2,'2',2,'2');
--insert into Org values(3,'3',3,'3');
--insert into Person values(3,'3','3','3','ru',null,null)
--insert into Person values(3,'3','3','3','en',null,null)
--insert into Person values(3,'3','3','3','en','ru',null)
--insert into Contact values(1,1,'1','1')
--insert into Contact values(2,1,'1','1')
--insert into Contact values(3,3,'3','3');
--insert into Contact values(2,3,'3','3');
--select * from MultyContactPersonnel;
--update MultyContactPersonnel set Contact_note='1' ;
--select * from Contact
<?php
function LoadGIF($imgname, $filename, $rank)
{
$im = imagecreatefromgif($imgname);
if(!$im)
{
$im = imagecreatetruecolor(88, 31);
$bgc = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, 88, 31, $bgc);
}
$tc = imagecolorallocate($im, 0, 0, 0);
$font='./arial.ttf';
imagettftext($im, 20, 0, 27, 26, $tc, $font, $rank);
imagegif($im, $filename);
imagedestroy($im);
}
// header('Content-Type: image/gif');
LoadGIF('counter.gif', './lol.gif', '355');
?>
<?php
function LoadGIF2($imgname, $filename, $text)
{
$im = @imagecreatefromgif($imgname);
if(!$im)
{
$im = imagecreatetruecolor(380, 20);
$bgc = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, 380, 20, $bgc);
}
$tc = imagecolorallocate($im, 0, 0, 0);
$font='./arial.ttf';
$fsize=16;
$size=imagettfbbox($fsize, 0, $font, $text) ;
$x=380 - max($size[2], $size[4]);
imagettftext($im, $fsize, 0, $x, 16, $tc, $font, $text);
imagegif($im, $filename);
imagedestroy($im);
}
//header('Content-Type: image/gif');
LoadGIF2('counter2.gif', './lol2.gif', 'Сервера сервера сервера');
?>
пример работы
http://cs-serv.org.ru/1.php
http://cs-serv.org.ru/2.php