ok do not worry, please do the below this as i explain here
Step 1:-
Create a new database having name “test” for testing.
After creating database run below sql for create “rent’’ table
CREATE TABLE IF NOT EXISTS rent
(
id
int(11) NOT NULL auto_increment,
location
varchar(255) NOT NULL,
area
varchar(255) NOT NULL,
bedroom
varchar(255) NOT NULL,
budget
varchar(255) NOT NULL,
PRIMARY KEY (id
)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
–
– Dumping data for table rent
INSERT INTO rent
(id
, location
, area
, bedroom
, budget
) VALUES
(1, ‘Central_Mumbai’, ‘Bhandup’, ‘2BHK’, ‘5000’);
Run below sql for create “sale’’ table
CREATE TABLE IF NOT EXISTS sale
(
id
int(11) NOT NULL auto_increment,
location
varchar(255) NOT NULL,
area
varchar(255) NOT NULL,
bedroom
varchar(255) NOT NULL,
budget
varchar(255) NOT NULL,
PRIMARY KEY (id
)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
–
– Dumping data for table sale
INSERT INTO sale
(id
, location
, area
, bedroom
, budget
) VALUES
(1, ‘Mumbai_Harbour’, ‘Chembur’, ‘3BHK’, ‘5000_10000’);
#Save below File as “testsrform.php”
[php]
#Save below File as “testsrform.php”
Sanjay Rao Logic
Rent
Sale
----Select Budget For Rent----
5000
5000 to 10000
11000 to 20000
<option value="above_20000">Above 20000</option>
----Select Budget For Sale----
100000
500000
1000000
<option value="above_20000">2500000</option>
----Select Location--- All Location
Central Mumbai
Mumbai Harbour
Mumbai Navi
Mumbai South
Mumbai Thane
-----Select Area---
All Area
Bhandup
Chembur
Kurla
Mulund
All Area
Byculla
Chembur
Govandi
Sewri
Wadala
All Area
Airoli
Belapur
Ghansoli
Mahape
Nerula
All Area
Churchgate
CST
Dadar
Fort
All Area
Brindavan
Kalothe
Kapur
Kalwa
Kopat
---Select Bedroom---
1 BHK
2 BHK
3 BHK
4 BHK
[/php]
Save below File as “testsrajax.php”
// please add your database detail mysql_connect(“localhost”,“YOUR DATABASE USER NAME”,“YOUR DATABASE USER PASSWORD”);
[php]
##Save below File as “testsrajax.php”
$db = mysql_connect(“localhost”,“root”,“root”); // please add your database detail mysql_connect(“localhost”,“YOUR DATABASE USER NAME”,“YOUR DATABASE USER PASSWORD”);
mysql_select_db(“test”); // if you create database name
// table name must be rent and sale because i hvae used them below in query.
$location = $_POST['location'];
$area = $_POST['area'];
$bedroom = $_POST['bedroom'];
$resp = '';
if($_POST['table'] == 'rent_table')
{
$rentbudget = $_POST['rentvalue'];
$sql = "select * from rent where location='".$location."' AND area='".$area."' AND bedroom='".$bedroom."' AND budget='".$rentbudget."'";
}
elseif($_POST['table'] == 'sale_table')
{
$salebudget = $_POST['salevalue'];
$sql = "select * from rent where location='".$location."' AND area='".$area."' AND bedroom='".$bedroom."' AND budget='".$salebudget."'";
}
$result=mysql_query($sql,$db);
$number=mysql_num_rows($result);
$resp .= "<table cellpadding='20'>";
$resp .= '<tr>';
if($number > 0)
{
while($row = mysql_fetch_array($result))
{
$resp .= "<td width='300'><strong>Budget:</strong> ".$row['budget']."<br><strong>Location</strong>: ".$row['location']."<br><strong>Area:</strong> ".$row['area']."<br><strong>BHK:</strong> ".$row['bedroom']."<br></td>";
}
}
else
{
$resp .='<td> no record found</td>';
}
$resp .= "</tr></table>";
print_r($resp);
exit;
[/php]
Put both file(testsrform.php, testsrajax.php) at same folder.
DO BELOW THING
For rent table
//Now run the “testsrform.php” than click rent radio button.
// select 5000 from select budget for rent dropdown.
// select Central Mumbai from location dropdown.
// select Bhandup from area dropdown.
//select 2 BHK from Bedroom dropdown.
For sale table
//Now run the “testsrform.php” than click sale radio button.
// select 500000 from select budget for rent dropdown.
// select Mumbai Harbour from location dropdown.
// select Chembur from area dropdown.
//select 3 BHK from Bedroom dropdown.
Reply your feedback
~SR~