PLEASE HELP: SEARCH IS MAKING MY HEAD SPIN
Posted: Thu Sep 20, 2007 4:11 am
feyd | Please use
Ok I think I should mention that I'm using Dreamweaver to make this site.
Now the other file is supposed to present the results for the search.
named search_results.php[/syntax]
The file that is being included/required once just holds my database connection information.
Please if anyone can help me in fixing this error I will be very appreciative, please bear in mind that I'm an absolute noob in this field but would like to further myself.
I thank you all in advance and I'm hopeful that a response will be given soon.
Hex
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi all
I'm very new to the whole PHP concept and webdesigning as well.... but being the type of person who never backs down from a challenge, I've under taken to make a website for a real estate agency.
Now for my problem, I want to add a search engine to the site so that visitors can simply search for a house that is within their interests convieniently from the home page.
Now I have made to files just to check if I can yeild results from the database before I even attempt in the making of the site, the issue is that the search does not produce any results, no error msg or anything just a blank window with a place holder for where the picture should be, I must also state that everything I have in the form of code for these files has been collected off many sites (going through tutorials) and a bit of logical thinking on my part (starting to think I'm not all that logical )
Here is the first files code.... It should be the search form that allows the visitor to select the Type, Area and Price range for the house that they are looking for.
The File is named search.php
[syntax="html"]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form action="search_results.php" method="GET" name="Propsearch" id="Search">
<p>Type:
<select name="Type" id='1'>
<option value="Residential">Residential</option>
<option value="Sectional Title">Sectional Title</option>
<option value="Vacant Land">Vacant Land</option>
</select>
</p>
<p>Area:
<select name="Area" id='2'>
<option value="Margate">Margate</option>
<option value="Shelly Beach">Shelly Beach</option>
<option value="Ramsgate">Ramsgate</option>
</select>
</p>
<p>Price From:
<select name="Price1 " id='3'>
<option value="0">0</option>
<option value="1000000">1000000</option>
<option value="2000000">2000000</option>
<option value="3000000">3000000</option>
<option value="4000000">4000000</option>
</select>
To:
<select name="Price2" id='4'>
<option value="1000000">1000000</option>
<option value="2000000">2000000</option>
<option value="3000000">3000000</option>
<option value="4000000">4000000</option>
<option value="1000000000">>4000000</option>
</select>
</p>
<p>
<input type="Submit" name="Search" value="Search" />
</p>
</form>
</body>
</html>
Now the other file is supposed to present the results for the search.
named search_results.php[/syntax]
Code: Select all
<?php require_once('Connections/search.php');?>
<?
$Type=$_GET('form1'['1'])
$Area=$_GET('form1'['2'])
$Price1=$_GET('form1'['3'])
$Price2=$_GET('form1'['4'])
?>
<?php
mysql_select_db($database_search, $search);
$query_Rs007 = "SELECT * FROM prop WHERE prop.tb_type ='%$Type%' AND prop.tb_area ='%$Area%' AND prop.tb_price BETWEEN '%$Price1%' AND '%$Price2%' ORDER BY prop.tb_id";
$query_limit_Rs007 = sprintf("%s LIMIT %d, %d", $query_Rs007, $startRow_Rs007, $maxRows_Rs007);
$Rs007 = mysql_query($query_limit_Rs007, $search) or die(mysql_error());
$row_Rs007 = mysql_fetch_assoc($Rs007);
if (isset($_GET['totalRows_Rs007'])) {
$totalRows_Rs007 = $_GET['totalRows_Rs007'];
} else {
$all_Rs007 = mysql_query($query_Rs007);
$totalRows_Rs007 = mysql_num_rows($all_Rs007);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<table width="100%" border="0">
<?php do { $maxRows_Rs007 = 10;
$pageNum_Rs007 = 0;
if (isset($_GET['pageNum_Rs007'])) {
$pageNum_Rs007 = $_GET['pageNum_Rs007'];
}
$startRow_Rs007 = $pageNum_Rs007 * $maxRows_Rs007;?>
<tr>
<th width="14%" rowspan="2" scope="col"><img src="<?php echo $row_Rs007['tb_pic']; ?>"></th>
<th width="26%" scope="col"> <div align="left"><?php echo $row_Rs007['tb_area']; ?> </div></th>
<th width="34%" scope="col"><?php echo $row_Rs007['tb_type']; ?></th>
<th width="26%" scope="col"><div align="right"><?php echo $row_Rs007['tb_price']; ?></div></th>
</tr>
<tr>
<td colspan="3"><div align="center"><?php echo $row_Rs007['tb_details']; ?></div></td>
</tr>
<?php } while ($row_Rs007 = mysql_fetch_assoc($Rs007)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Rs007);
?>Please if anyone can help me in fixing this error I will be very appreciative, please bear in mind that I'm an absolute noob in this field but would like to further myself.
I thank you all in advance and I'm hopeful that a response will be given soon.
Hex
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]