shakemelikeapig
New Member
I am working on a real estate property website. On the properties page PHP calls to the database to retrieve the list of properties to display. It calls to the table and displays them but with a default page title listed in frames.php...HOW can I have each property name listed in the title tag if it is selected from the list? I am so lost, so please bare with me...ask questions because I have no idea what I'm doing...
Thanks, here is what I think is the most important snippet of code from properties.php file...
Thanks, here is what I think is the most important snippet of code from properties.php file...
PHP:
<?php
session_start();
include ("frames.php");
$pg='properties';
/************************ Get the property name *******************/
if (isset($_GET['p']))
$p = preg_replace('/[^0-9a-zA-Z]/', '', $_GET['p']);
else
$p = '';
/********************* Get its id from the property table *****************/
$db=mysql_connect ("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
if(!$db) die("Could not connect to MySQL");
mysql_select_db("XXXXXXXX",$db) or die ("could not open db".mysql_error());
$query = "select * from prop";
$result = mysql_query($query);
$res_array = array();
for ($count=0; $row = mysql_fetch_assoc($result); $count++)
$res_array[$count] = $row;
foreach ($res_array as $row) {
$tmp = preg_replace('/[^0-9a-zA-Z]/', '', $row['title']);
if ($tmp == $p) {
$id = $row['id'];
break;
}
}
if (isset($_GET['m']))
$p = preg_replace('/[^0-9a-zA-Z]/', '', $_GET['m']);
else
$p = '';
if ($p == 'map' || $id == 0)
head($pg, $id);
else
head('notprop', $id);
/***************** LEFT COLUMN MENU AND BUTTONS *************************/
echo '<div class="leftcolumn">';
echo '<a href="'.PATH.'properties"><img src="'.PATH.'images/our_properties.gif"></a>';
echo '<img src="'.PATH.'images/view_all_for_properties.gif" style="margin: 10px 0 0 0;">';
/** Find out if this is a commercial property. Customize **/
/** application form if we're showing an individual property **/
/** that's also not commercial **/
$result = query_database("select * from prop, areas where prop.area = areas.id and prop.id = '$id'");
$commercialFlag = $result[0]['commercial'];
if ($commercialFlag == "" && $id != 0) {
echo '<form action="'.PATH.'apply" method="post">';
echo '<input type="hidden" name="sendemail" value="1" style="display: none;">';
echo '<input type="hidden" name="id" value="'.$id.'" style="display: none;">';
echo '<input type="image" src="'.PATH.'images/apply_online_for_properties.gif" style="width: 296px; height: 34px; margin: 10px 4px 0 0;">';
echo '</form>';
}
else {
echo '<a href="'.PATH.'apply"><img src="'.PATH.'images/apply_online_for_properties.gif" style="margin: 10px 0 0 0;"></a>';
}
echo '<img src="'.PATH.'images/our_property.gif" style="margin: 10px 0 10px -1px; width: 297px;">';
/***** Display left side menu ******/
$result = query_database("select * from areas order by displayorder");
/***** First show the area ******/
foreach ($result as $row) {
echo '<div class="menuitem" style="font-weight: bold;">';
echo $row['title'];
echo '</div>';
$areaID = $row['id'];
$result = query_database("select * from prop where area = $areaID order by displayorder");
/***** Now show the property ******/
foreach ($result as $row) {
$pgurl = str_replace(' ', '',preg_replace('/[^a-zA-Z0-9\s]/', '', $row['title']));
if ($row['id'] == $id) {
echo '<div class="menuitem" style="color: #8E8A6D; margin: 0; font-size: 12px; width: 275px; float: right; background-color: #E6F5A9">';
}
else {
echo '<div class="menuitem" style="color: #8E8A6D; margin: 0; font-size: 12px; width: 275px; float: right;">';
}
echo '<a href="'.PATH.$pgurl.'">›› '.$row['title'].'</a>';
echo '</div>';
}
echo '<div class="divider"> </div>';
}
</div> <?php