Jessica I believe I have used it (it is saved in '$correct_id').
What worries me is that this code is unable to execuite:
[$placesql = "SELECT tourism_sites.*, towns.*, place.*, photos.* FROM tourism_sites, towns, place, photos
WHERE tourism_sites.cat_id = towns.id AND towns.id = place.cat_id AND place.id = photos.id AND photos.image_id = " . $correct_id;]
No any number e.g 1, 2, 3 etc is seen on the URL instead, it redirects me to BASE_DIR i.e header("Location: " . BASE_DIR);
Is it because the id sent from index.php to the url does not meet the below conditions?
<?php
if(isset($_GET['id']) == TRUE) {
if(is_numeric($_GET['id']) == FALSE) {
header("Location: " . BASE_DIR);
}
$correct_id = $_GET['id'];
}
else {
header("Location: " . BASE_DIR);
}
?>
I expected to see something like - details.php?id=1 or details.php?id=2 depending on the link clicked. What do you say? Thanks.
===========================================================================================================
<?php
if(isset($_GET['id']) == TRUE) {
if(is_numeric($_GET['id']) == FALSE) {
header("Location: " . BASE_DIR);
}
$correct_id = $_GET['id'];
}
else {
header("Location: " . BASE_DIR);
}
?>
<!-- start page -->
<div id="page">
<!-- start content -->
<div id="content">
<div class="post">
<h2>Reservation</h2>
<?php
/*
*this query links to variable . $sitenumrows['id'] of index.php to display further information about
* $site2numrows['hotel_name']
*/
$placesql = "SELECT tourism_sites.*, towns.*, place.*, photos.* FROM tourism_sites, towns, place, photos
WHERE tourism_sites.cat_id = towns.id AND towns.id = place.cat_id AND place.id = photos.id AND photos.image_id = " . $correct_id;
$placeresult = mysql_query($placesql);
$placenumrow = mysql_num_rows($placeresult);
if($placenumrow == 0){
echo "<h2 class = 'results'>There was a problem querrying database</h2>";
}
else{
while ($placenumrow == mysql_fetch_assoc($placeresult)){
echo "<h2 class = 'title'>" . $placenumrow['town_name'] . "</p>";
}
}
?>