php script for creating vcf

I had added this script as 'applications/views/contacts/vcard.php'
The script using contacts class was not working for me. There might be some bug by me. In the meantime, here is the direct one. The way to call it will be vcard.php?id='whatever id '
I had added this to the card.php for adding the link to download the visiting card
add_page_action(array(
lang('create a vcard') => "application/views/contacts/vcard.php?id=".$contact->getId()
));

Please tell me what modifications are needed.

<?php

require('../../../config/config.php');
header('Content-Type: text/csv; charset=utf-8');   //To tell that the data is a visiting card format
?>

<?php
$conn
= mysql_connect(DB_HOST, DB_USER, DB_PASS)
or die(
'Could not connect to MySQL database. ' . mysql_error());
mysql_select_db(DB_NAME,$conn)or die(mysql_error());
$rows = mysql_query('SELECT display_name,title,email,home_number,office_number,fax_number FROM `'.DB_PREFIX.'contacts` where id='.$_GET['id']);
$row = mysql_fetch_array($rows);
$comp = mysql_query('SELECT name FROM `'.DB_PREFIX.'companies` where client_of_id='.$_GET['id']);
$company = mysql_fetch_array($comp);
?>

BEGIN:VCARD
VERSION:3.0
FN:

<?php
echo $row['display_name']."\n";
?>

ORG:

<?php
echo $company['name']."\n";
?>

TITLE:

<?php
echo $row['title']."\n";
?>

TEL;TYPE=WORK,VOICE:

<?php
echo $row['office_number']."\n";
?>

TEL;TYPE=HOME,VOICE:

<?php
echo $row['home_number']."\n";
?>

EMAIL;TYPE=PREF,INTERNET:

<?php
echo $row['email']."\n";
?>

REV:

<?php
$today
= getdate();
echo
$today['year']."-".$today['mon']."-".$today['mday']."T".$today['hours'].":".$today['minutes'].":".$today['seconds']."z"."\n";
?>

END:VCARD

<?php
header
('Content-Disposition: attachment; filename='.$row['display_name'].'.vcf'); //To make the data downloadable
?>

This code was just to give a basic idea to jp.joao about what I was doing. The code is incomplete and has a lot of bugs and like jp.joao has pointed out, kind of useless. Hence, ignore the code