prepare(); // Error checking to make sure people have entered a search phrase if ( empty($_GET[p_id]) ) { header("Location: about.htm"); exit(); } else // Do the search { $sql_query = "SELECT passengers.*, headers.*, country.*, occupation.*, ports.*, cdest.*, province.code, province.province as pr_province, YEAR( m_arr_date ) AS `m_year`, MONTH( m_arr_date ) AS m_month, DAYOFMONTH( m_arr_date ) AS m_day FROM `passengers`, `headers` , `country`, `occupation`, `ports`, `cdest`, `province` WHERE p_id = $_GET[p_id] AND `p_mid` = `m_mid` AND `co_code` = `p_country` AND `p_occupation` = `o_code` AND `po_code` = `m_po_code` AND `p_cdest` = `de_code` AND passengers.province = province.code "; $q_id_main = $DB->sql_query($sql_query); $row = $DB->sql_fetchrow($q_id_main); $tpl->assign("pr_province", $row[pr_province]); $tpl->assign("link_back",$HTTP_REFERER); $tpl->assign("p_id",$row[p_id]); $tpl->assign("p_last_name",$row[p_last_name]); $tpl->assign("p_first_name",$row[p_first_name]); if ( $row[p_age] == "800" || $row[p_age] <= 0) $tpl->assign("p_age","U"); else if ( $row[p_age] > 110 && $row[p_age] != 800) { $age = $row[p_age] - 900; $tpl->assign("p_age",$age . " months"); } else { $tpl->assign("p_age",$row[p_age]); } if ( $row[p_literacy] == "Y") $tpl->assign("p_literacy", "Yes"); else if ( $row[p_literacy] == "N") { $tpl->assign("p_literacy", "No"); } else { $tpl->assign("p_literacy", "Unknown"); } if ( $row[p_gender] == "M") $tpl->assign("p_gender","Male"); else if ( $row[p_gender] == "F") { $tpl->assign("p_gender","Female"); } else { $tpl->assign("p_gender","Unknown"); } $tpl->assign("po_port",$row[po_port]); $tpl->assign("town",$row[town]); $tpl->assign("de_city",$row[de_city]); $tpl->assign("o_occ",$row[o_occ]); $tpl->assign("co_country",$row[co_country]); $tpl->assign("m_arr_date",$row[m_day] . " " . $FV->num_to_month($row[m_month]) . " " . $row[m_year]); $tpl->assign("m_ship",$row[m_ship]); //$tpl->assign("pl_plan",$FV->p_passage_to_plan($row[p_passage])); // The 2 (3?) following lines require existence of proper tables // 'plan' and 'transcode'; otherwise they silently fail. For more // information look inside 'classes/class.Format_Vars.php' and // possibly deeper. roberto.jimeno@gmail.com, 2009-07-30. $tpl->assign("pl_plan",$FV->p_passage_to_plan($row[p_transcode])); $tpl->assign("pa_passage",$FV->p_passage_to_passage($row[pa_passage])); $tpl->assign("money", $row[money]); $tmp=$FV->lookupRelation($row[relation_1]); if ($tmp=="Self") $tmp="" ; $tpl->assign("relation_1", $tmp); $tpl->assign("rel1_name", $row[rel1_name]); $tpl->assign("rel1_addr", $row[rel1_addr]); if ($row[paid_by]==0) $tpl->assign("paid_by", "Self"); else $tpl->assign("paid_by", $row[paid_by]); if ( $row[us_before] == "Y") $tpl->assign("us_before", "Yes"); else if ( $row[us_before] == "N") $tpl->assign("us_before", "No"); else $tpl->assign("us_before", "Unknown"); $tpl->assign("us_when", $row[us_when]); $tpl->assign("us_where", $row[us_where]); $tmp=$FV->lookupRelation($row[relation_2]); if ($tmp=="Self") $tmp="" ; $tpl->assign("relation_2", $tmp); if ( $row[to_rel] == "Y") $tpl->assign("to_rel", "Yes"); else if ( $row[to_rel] == "N") $tpl->assign("to_rel", "No"); else $tpl->assign("to_rel", "Unknown"); $tpl->assign("rel2_name", $row[rel2_name]); $tpl->assign("rel2_addr", $row[rel2_addr]); $tpl->assign("rel2_city", $row[rel2_city]); $tpl->assign("birth_country",$FV->lookupCountry($row[birth_country])); //$tpl->assign("birth_country", $row[birth_country]); $tpl->assign("birth_city", $row[birth_city]); $tpl->assign("ticket", $row[ticket]); // Comparitive Results // ======== 1 ======== /* $sql_1 = "SELECT COUNT(*) AS `counter_1` FROM `passengers`,`country` WHERE p_last_name = '$row[p_last_name]' AND p_first_name = '$row[p_first_name]' AND p_country = $row[p_country] AND `co_code` = `p_country`;"; $q_id_1 = $DB->sql_query($sql_1); $row_1 = $DB->sql_fetchrow($q_id_1); $tpl->assign("num1",$row_1[counter_1]); if ( $row_1[counter_1] > 1 ) $tpl->assign("num1_people","people"); else $tpl->assign("num1_people","person"); */ } $end = benchit(); $tpl->assignGlobal("C_Time", round( $end - $start, 3 )); $tpl->assignGlobal("Queries",$DB->num_queries); $tpl->printToScreen(); ?>