PC Pitstop Virtual Employees

<?
$user=”pitboss”;
$host=”localhost”;
$password=”swus7aTR”;
$database = “virtualBoss”;
$today=getdate();
$connection = mysql_connect($host,$user,$password)
or die (“couldn’t connect to server”);
$db = mysql_select_db($database)
or die (“Couldn’t select database”);
$query = “SELECT * FROM people WHERE current =1 order by StartDate”;
$result = mysql_query($query)
or die (“Couldn’t execute query.”);
echo mysql_num_rows($result).” employees”;
echo ”

“;while ($row = mysql_fetch_array($result)){extract($row);list($year,$month,$day) = explode(“-“,$Birthday);$year_diff = date(“Y”) – $year;$month_diff = date(“m”) – $month;$day_diff = date(“d”) – $day;if ($month_diff < 0 || ($month_diff==0 && $day_diff > 0)) $year_diff–;list($year,$month,$day) = explode(“-“,$StartDate);$year_diff1 = date(“Y”) – $year;$month_diff = date(“m”) – $month;$day_diff = date(“d”) – $day;if ($month_diff < 0 || ($month_diff==0 && $day_diff > 0)) $year_diff1–;if ($month_diff==0 && $day_diff > 0) $month_diff=11;if ($month_diff < 0) $month_diff=12+$month_diff; $firstname=substr($Name,0,strpos($Name,” “)); if (strlen($Hobbies)>35) $Hobbies = substr($Hobbies,0,35).”…()”;
if (strlen($Work)>25) $Work = substr($Work,0,25).”…()”;
if (strlen($Advantages)>75) $Advantages = substr($Advantages,0,75).”…()”;if (strlen($Disadvantages)>75) $Disadvantages = substr($Disadvantages,0,75).”…()”;echo “”;
}
echo ”

$Name
Position $Job
Location $Location
Age / Marital Status $year_diff years / $MaritalStatus
Time at Pitstop $year_diff1 years”;
if ($month_diff != 0 ) echo ” $month_diff months”;
echo “
Hobbies $Hobbies
Work Experience $Work
Advantages of
Working Virtual
$Advantages
Disadvantages of Working Virtual $Disadvantages

“;

?>

“.$firstname.”‘s Hobbies”.$Hobbies.”
“.$firstname.”‘s Experience”.$Work.”
“.$firstname.”‘s Advantages”.$Advantages.”
“.$firstname.”‘s Disadvantages”.$Disadvantages.”

About the Author