Zoom …

‘1’)
{WHILE ($row = mysql_fetch_array($result))
{$p_previous = $row[‘0’] ;
$go_back = $go_back . ‘‘ . $row[‘1’] . ” (” . $row[‘2’] . “)” . ‘; ‘;
}
$query = “SELECT pr.place_id1, p.place_name,pt.description” .
” FROM trv_place_rel pr” .
” JOIN trv_place p ON p.place_id = pr.place_id1″ .
” JOIN trv_place_type pt ON pt.type = p.place_type” .
” WHERE pr.place_id2 = ‘”. $p_previous . “‘”;
$result = mysql_query($query);
}
}

// When $p_type is a place
IF ($p_type == ‘P’)
{// Get data
$query = ‘SET SQL_BIG_SELECTS=1;’;
$result = mysql_query($query);
$query = ‘SELECT p.place_id, p.place_name, p.place_name_orig,’ .
‘ p.place_type, r.place_split, r.place_order,’ .
‘ r.place_id1, r.place_id2, t.description,’ .
‘ ( SELECT count(DISTINCT (‘ .
‘ CASE WHEN n1.place_id2 is null’ .
‘ THEN n1.place_id1’ .
‘ ELSE’ .
‘ CASE WHEN n2.place_id2 is null’ .
‘ THEN n1.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n3.place_id2 is null’ .
‘ THEN n2.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n4.place_id2 is null’ .
‘ THEN n3.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n5.place_id2 is null’ .
‘ THEN n4.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n6.place_id2 is null’ .
‘ THEN n5.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n7.place_id2 is null’ .
‘ THEN n6.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n8.place_id2 is null’ .
‘ THEN n7.place_id2’ .
‘ ELSE n8.place_id2’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END))’ .
‘ FROM trv_place_rel as n1’ .
‘ LEFT JOIN trv_place_rel as n2 on n2.place_id1 = n1.place_id2’ .
‘ LEFT JOIN trv_place_rel as n3 on n3.place_id1 = n2.place_id2’ .
‘ LEFT JOIN trv_place_rel as n4 on n4.place_id1 = n3.place_id2’ .
‘ LEFT JOIN trv_place_rel as n5 on n5.place_id1 = n4.place_id2’ .
‘ LEFT JOIN trv_place_rel as n6 on n6.place_id1 = n5.place_id2’ .
‘ LEFT JOIN trv_place_rel as n7 on n7.place_id1 = n6.place_id2’ .
‘ LEFT JOIN trv_place_rel as n8 on n8.place_id1 = n7.place_id2’ .
‘ WHERE n1.place_id1 = r.place_id2),’ .
‘ ( SELECT count(DISTINCT (‘ .
‘ CASE WHEN n1.place_id2 is null’ .
‘ THEN n1.place_id1’ .
‘ ELSE’ .
‘ CASE WHEN n2.place_id2 is null’ .
‘ THEN n1.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n3.place_id2 is null’ .
‘ THEN n2.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n4.place_id2 is null’ .
‘ THEN n3.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n5.place_id2 is null’ .
‘ THEN n4.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n6.place_id2 is null’ .
‘ THEN n5.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n7.place_id2 is null’ .
‘ THEN n6.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n8.place_id2 is null’ .
‘ THEN n7.place_id2’ .
‘ ELSE n8.place_id2’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END))’ .
‘ FROM trv_place_rel as n1’ .
‘ LEFT JOIN trv_place_rel as n2 on n2.place_id1 = n1.place_id2’ .
‘ LEFT JOIN trv_place_rel as n3 on n3.place_id1 = n2.place_id2’ .
‘ LEFT JOIN trv_place_rel as n4 on n4.place_id1 = n3.place_id2’ .
‘ LEFT JOIN trv_place_rel as n5 on n5.place_id1 = n4.place_id2’ .
‘ LEFT JOIN trv_place_rel as n6 on n6.place_id1 = n5.place_id2’ .
‘ LEFT JOIN trv_place_rel as n7 on n7.place_id1 = n6.place_id2’ .
‘ LEFT JOIN trv_place_rel as n8 on n8.place_id1 = n7.place_id2’ .
‘ WHERE n1.place_id2 = r.place_id2 AND’ .
‘ ( SELECT DISTINCT (‘ .
‘ CASE WHEN n1.place_id2 is null’ .
‘ THEN n1.place_id1’ .
‘ ELSE’ .
‘ CASE WHEN n2.place_id2 is null’ .
‘ THEN n1.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n3.place_id2 is null’ .
‘ THEN n2.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n4.place_id2 is null’ .
‘ THEN n3.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n5.place_id2 is null’ .
‘ THEN n4.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n6.place_id2 is null’ .
‘ THEN n5.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n7.place_id2 is null’ .
‘ THEN n6.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n8.place_id2 is null’ .
‘ THEN n7.place_id2’ .
‘ ELSE n8.place_id2’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END) in (select fk_place_id from trv_visit))),’ .
‘ ( SELECT count(DISTINCT(poi.poi_id))’ .
‘ FROM trv_place_rel as n1’ .
‘ LEFT JOIN trv_place_rel as n2 on n2.place_id1 = n1.place_id2’ .
‘ LEFT JOIN trv_place_rel as n3 on n3.place_id1 = n2.place_id2’ .
‘ LEFT JOIN trv_place_rel as n4 on n4.place_id1 = n3.place_id2’ .
‘ LEFT JOIN trv_place_rel as n5 on n5.place_id1 = n4.place_id2’ .
‘ LEFT JOIN trv_place_rel as n6 on n6.place_id1 = n5.place_id2’ .
‘ LEFT JOIN trv_place_rel as n7 on n7.place_id1 = n6.place_id2’ .
‘ LEFT JOIN trv_place_rel as n8 on n8.place_id1 = n7.place_id2’ .
‘ JOIN trv_poi as poi on poi.fk_place_id = ‘.
‘ ( SELECT DISTINCT (‘ .
‘ CASE WHEN n1.place_id2 is null’ .
‘ THEN n1.place_id1’ .
‘ ELSE’ .
‘ CASE WHEN n2.place_id2 is null’ .
‘ THEN n1.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n3.place_id2 is null’ .
‘ THEN n2.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n4.place_id2 is null’ .
‘ THEN n3.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n5.place_id2 is null’ .
‘ THEN n4.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n6.place_id2 is null’ .
‘ THEN n5.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n7.place_id2 is null’ .
‘ THEN n6.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n8.place_id2 is null’ .
‘ THEN n7.place_id2’ .
‘ ELSE n8.place_id2’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END)) ‘ .
‘ WHERE n1.place_id2 = r.place_id2)’ .
‘ FROM patrickvandewie.trv_place AS p’ .
‘ JOIN patrickvandewie.trv_place_rel AS r ON r.place_id2 = p.place_id’ .
‘ JOIN patrickvandewie.trv_place_type AS t ON p.place_type = t.type’ .
‘ WHERE r.place_id1 = ‘ . $p_place .
‘ ORDER BY r.place_order;’;
}

// When $p_type is a visit
IF ($p_type == ‘V’)
{// Get data
$query = ‘SET SQL_BIG_SELECTS=1;’;
$result = mysql_query($query);
$query = ‘SELECT DISTINCT p.place_name, p.place_name_orig, pt.description, vt.description, ‘ .
‘ v.from_date, v.till_date’ .
‘ FROM trv_visit AS v’ .
‘ JOIN trv_visit_type AS vt ON vt.visit_type = v.visit_type’ .
‘ JOIN trv_place AS p ON p.place_id = v.fk_place_id’ .
‘ JOIN trv_place_type AS pt ON pt.type = p.place_type’ .
‘ LEFT JOIN trv_place_rel as n1 on n1.place_id2 = ‘ . $p_place .
‘ LEFT JOIN trv_place_rel as n2 on n2.place_id1 = n1.place_id2’ .
‘ LEFT JOIN trv_place_rel as n3 on n3.place_id1 = n2.place_id2’ .
‘ LEFT JOIN trv_place_rel as n4 on n4.place_id1 = n3.place_id2’ .
‘ LEFT JOIN trv_place_rel as n5 on n5.place_id1 = n4.place_id2’ .
‘ LEFT JOIN trv_place_rel as n6 on n6.place_id1 = n5.place_id2’ .
‘ LEFT JOIN trv_place_rel as n7 on n7.place_id1 = n6.place_id2’ .
‘ LEFT JOIN trv_place_rel as n8 on n8.place_id1 = n7.place_id2’ .
‘ WHERE ( SELECT DISTINCT (‘ .
‘ CASE WHEN n1.place_id2 is null’ .
‘ THEN n1.place_id1’ .
‘ ELSE’ .
‘ CASE WHEN n2.place_id2 is null’ .
‘ THEN n1.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n3.place_id2 is null’ .
‘ THEN n2.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n4.place_id2 is null’ .
‘ THEN n3.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n5.place_id2 is null’ .
‘ THEN n4.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n6.place_id2 is null’ .
‘ THEN n5.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n7.place_id2 is null’ .
‘ THEN n6.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n8.place_id2 is null’ .
‘ THEN n7.place_id2’ .
‘ ELSE n8.place_id2’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END)) = v.fk_place_id’ .
‘ ORDER BY v.from_date,v.till_date;’;
}

// When $p_type is a Point of Interest
IF ($p_type == ‘POI’)
{// Get data
$query = ‘SET SQL_BIG_SELECTS=1;’;
$result = mysql_query($query);
$query = ‘SELECT DISTINCT p.place_name, p.place_name_orig, pt.description, poit.description, ‘ .
‘ poi.description’ .
‘ FROM trv_poi AS poi’ .
‘ JOIN trv_poi_type AS poit ON poit.poi_type = poi.poi_type’ .
‘ JOIN trv_place AS p ON p.place_id = poi.fk_place_id’ .
‘ JOIN trv_place_type AS pt ON pt.type = p.place_type’ .
‘ LEFT JOIN trv_place_rel as n1 on n1.place_id2 = ‘ . $p_place .
‘ LEFT JOIN trv_place_rel as n2 on n2.place_id1 = n1.place_id2’ .
‘ LEFT JOIN trv_place_rel as n3 on n3.place_id1 = n2.place_id2’ .
‘ LEFT JOIN trv_place_rel as n4 on n4.place_id1 = n3.place_id2’ .
‘ LEFT JOIN trv_place_rel as n5 on n5.place_id1 = n4.place_id2’ .
‘ LEFT JOIN trv_place_rel as n6 on n6.place_id1 = n5.place_id2’ .
‘ LEFT JOIN trv_place_rel as n7 on n7.place_id1 = n6.place_id2’ .
‘ LEFT JOIN trv_place_rel as n8 on n8.place_id1 = n7.place_id2’ .
‘ WHERE ( SELECT DISTINCT (‘ .
‘ CASE WHEN n1.place_id2 is null’ .
‘ THEN n1.place_id1’ .
‘ ELSE’ .
‘ CASE WHEN n2.place_id2 is null’ .
‘ THEN n1.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n3.place_id2 is null’ .
‘ THEN n2.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n4.place_id2 is null’ .
‘ THEN n3.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n5.place_id2 is null’ .
‘ THEN n4.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n6.place_id2 is null’ .
‘ THEN n5.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n7.place_id2 is null’ .
‘ THEN n6.place_id2’ .
‘ ELSE’ .
‘ CASE WHEN n8.place_id2 is null’ .
‘ THEN n7.place_id2’ .
‘ ELSE n8.place_id2’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END’ .
‘ END)) = poi.fk_place_id’ .
‘ ORDER BY poi.description;’;
}

$result = mysql_query($query);

// View result in table when type is place
IF ($p_type == ‘P’)
{IF ($result)
{echo ‘

‘;
IF ($p_place !== ‘1’)
{echo ‘

‘;
echo ‘

‘;
}
echo ‘

‘;
echo ‘

‘ .

‘ .

‘ .

‘ .

‘ .

‘;
echo ‘

‘;
while($row = mysql_fetch_array($result))
{echo ‘

‘;
IF ($row[‘9’] <> ‘0’)
{$v_link_place = ‘‘ . $row[“place_name”] . ‘‘;
}
ELSEIF ($row[’10’] <> ‘0’ OR $row[’10’] <> ‘0’)
{$v_link_place = ‘‘ . $row[“place_name”] . ‘‘;
}
ELSE
{$v_link_place = $row[“place_name”];
}
IF ($row[’10’] <> ‘0’)
{$v_link_visit = ‘‘ . $row[’10’] . ‘‘;
}
ELSE
{$v_link_visit = $row[’10’];
}
IF ($row[’11’] <> ‘0’)
{$v_link_poi = ‘‘ . $row[’11’] . ‘‘;
}
ELSE
{$v_link_poi = $row[’11’];
}
echo ‘

‘ .

‘ .

‘ .

‘ .

‘ .

‘;
echo ‘

‘;
IF ($row[“place_split”]==”Y”)
{echo ‘

‘;
echo ‘

‘ .

‘ .

‘ .

‘ .

‘;
echo ‘

‘;
}
}
echo ‘

‘ .
‘Plaatsen in ‘ . $from . ‘
‘ .
$go_back . ‘
Plaatsnaam Officiële naam Type plaats Plaatsen # POI # Bezocht #
‘ . $v_link_place . ‘ ‘ . $row[“place_name_orig”] . ‘ ‘ . $row[“description”] . ‘ ‘ . $row[‘9’] . ‘ ‘ . $v_link_poi . ‘ ‘ . $v_link_visit . ‘

‘;
}
}

// View result in table when type is visit
IF ($p_type == ‘V’)
{IF ($result)
{echo ‘

‘;
echo ‘

‘;
}
echo ‘

‘;
echo ‘

‘ .

‘ .

‘ .

‘ .

‘ .

‘;
echo ‘

‘;
while($row = mysql_fetch_array($result))
{echo ‘

‘;
echo ‘

‘ .

‘ .

‘ .

‘ .

‘ .

‘;
echo ‘

‘;
}
echo ‘

‘ .
‘Bezocht in ‘ . $from . ‘
‘ .
$go_back . ‘
Plaatsnaam Officiële naam Type plaats Type bezoek Van Tot
‘ . $row[“place_name”] . ‘ ‘ . $row[“place_name_orig”] . ‘ ‘ . $row[‘2’] . ‘ ‘ . $row[‘3’] . ‘ ‘ . $row[‘from_date’] . ‘ ‘ . $row[’till_date’] . ‘

‘;
}
}

// View result in table when type is Point Of Interest (POI)
IF ($p_type == ‘POI’)
{IF ($result)
{echo ‘

‘;
echo ‘

‘;
}
echo ‘

‘;
echo ‘

‘ .

‘ .

‘ .

‘ .

‘;
echo ‘

‘;
while($row = mysql_fetch_array($result))
{echo ‘

‘;
echo ‘

‘ .

‘ .

‘ .

‘ .

‘;
echo ‘

‘;
}
echo ‘

‘ .
‘Bezienswaardigheden in ‘ . $from . ‘
‘ .
$go_back . ‘
Plaatsnaam Officiële naam Type plaats Type POI Omschrijving
‘ . $row[“place_name”] . ‘ ‘ .
$row[“place_name_orig”] . ‘
‘ . $row[‘2’] . ‘ ‘ . $row[‘3’] . ‘ ‘ . $row[‘4’] . ‘

‘;
}
}

// View result in table when type is Detail (D)
IF ($p_type == ‘D’)
// {IF ($result)
// {echo ‘

‘;
// IF ($p_place !== ‘1’)
// {echo ‘

‘;
// echo ‘

‘;
// }

echo ‘Wordt aan gewerkt’;
// }

?>

‘ .
// ‘Plaatsen in ‘ . $from . ‘
‘ .
// $go_back . ‘