Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7040305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:54:09+00:00 2026-05-28T01:54:09+00:00

Actually i am performing a search in my database, there are two tables, rent

  • 0

Actually i am performing a search in my database, there are two tables, rent and sale. When user selects parameter for rent with the help of radio button and other parameters, it should search the data in rent table and return the result if it all matches. and same for second table.

But after executing my query i am getting error. Please help me in this.
I am posting all my codes here.

User selection page.

    <!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>real estate</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(document).ready(function() 
{
    $("input#tblsection").val('sale_table');
    $('input:radio[name=rbtn]').attr('checked',true);
    $("#rent").click(function() {
    $("#rentselect").attr('style', 'display:block;margin-top:20px;');
    $("#saleselect").attr('style', 'display:none;');
    $("input#tblsection").val('rent_table');
    });

    $("#sale").click(function() {
      $("#saleselect").attr('style', 'display:block;margin-top:20px;');
      $("#rentselect").attr('style', 'display:none;');
      $("input#tblsection").val('sale_table');

    });

    $("#srajax").click(function(){
     var rentvalue =  $('select#rentselect').val();
     var salevalue =  $('select#saleselect').val();
     var location =  $('select#location').val();
     var area =  $('select#Area').val();
     var bedroom =  $('select#bedroom').val();

    var table  = $('input#tblsection').val();
    $.post(" testajax.php", 
            { 
                rentvalue: rentvalue,
                salevalue: salevalue,
                location: location,
                area: area,
                bedroom: bedroom,
                table: table
            }, 
        function(data) {
                alert("Data Loaded: "+data);
         }); 
});

});



</script>
</head>

<body>

<form name="srajax" method="post">
<input type="radio" name="rbtn" value="rent" id="rent" /> <b>Rent</b>
<input type="radio" name="rbtn" value="sale" id="sale" /> <b>Sale</b>
<input type="hidden" name="tablenmae" id="tblsection" value="tablesale">

<br>
<select id="rentselect" style='display:none;'>
    <option value="">----Select Budget For Rent----</option>
    <option value="5000">5000</option>
    <option value="5000_10000">5000 to 10000</option>
    <option value="11000_20000">11000 to 20000</option>

    <option value="above_20000">Above 20000</option>
</select>


<select id="saleselect" style='margin-top:20px;margin-bottom:20px;'>
    <option value="">----Select Budget For Sale----</option>
    <option value="5000">100000</option>
    <option value="5000_10000">500000</option>
    <option value="11000_20000">1000000</option>

    <option value="above_20000">2500000</option>
</select>
<br>

<select id="location" name="Location">
<option>----Select Location---</option> <option value="All_Location">All Location</option>
<option value="Central_Mumbai">Central Mumbai</option>
<option value="Mumbai_Harbour">Mumbai Harbour</option>
<option value="Mumbai_Navi">Mumbai Navi</option>

<option value="Mumbai_South">Mumbai South</option>
<option value="Mumbai_Thane">Mumbai Thane</option> </select>

<br>
<br>
<select id="Area" name="Area">
<option value="">-----Select Area---</option>
<option value="All Area">All Area</option>
<option value="Bhandup">Bhandup</option>
<option value="Chembur">Chembur</option>

<option value="Kurla">Kurla</option>
<option value="Mulund">Mulund</option>

<option value="All Area">All Area</option>
<option value="Byculla">Byculla</option>
<option value="Chembur">Chembur</option>
<option value="Govandi">Govandi</option>
<option value="Sewri">Sewri</option>
<option value="Wadala">Wadala</option>

<option value="All Area">All Area</option>
<option value="Airoli">Airoli</option>
<option value="Belapur">Belapur</option>
<option value="Ghansoli">Ghansoli</option>
<option value="Mahape">Mahape</option>
<option value="Nerul">Nerula</option>

<option value="All Area">All Area</option>
<option value="Churchgate">Churchgate</option>

<option value="CST">CST</option>
<option value="Dadar">Dadar</option>
<option value="Fort">Fort</option>

<option value="All Area">All Area</option>
<option value="Brindavan">Brindavan</option>
<option value="Kalothe">Kalothe</option>
<option value="Kapur">Kapur</option>
<option value="Kalwa">Kalwa</option>

<option value="Kopat">Kopat</option> </select><br /><br>
<select id="bedroom" name="bedroom">
<option>---Select Bedroom---</option>
<option value="1BHK">1 BHK</option>
<option value="2BHK">2 BHK</option>
<option value="3BHK">3 BHK</option>
<option value="4BHK">3 BHK</option>
</select>


<br><br><br>
<input type="button" name="search" id="srajax" value="Search"/>
</form>
</body>
</html>

My search page

<?php 

$host="localhost"; // Host name 

$db_name="netelmbn_realestate"; // Database name 
$tbl1_name="rent_table"; // Table1 name  
$tbl2_name="sale_table"; //Table2 name 
mysql_connect("localhost","netelmbn","password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB"); 



echo "<pre>";
print_r($_POST);

if($_POST['table'] == 'rent_table')
{
  $result=mysql_query("select * from rent_table where location='$location' AND area='$area' AND bedroom='$bedroom' AND $budget='budget' ");
echo "<table cellpadding='20'>";

                echo '<tr>'; 


 while ($row = mysql_fetch_assoc($result)) { 
echo "<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['bhk']."<br></td>";
}
echo "</tr></table>";
}

if($_POST['table'] == 'sale_table')
{
   $result=mysql_query("select * from sale_table where location='$location' AND area='$area' AND bedroom='$bedroom' AND $budget='budget' ");
echo "<table cellpadding='20'>";

                echo '<tr>'; 


 while ($row = mysql_fetch_assoc($result)) { 
echo "<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['bhk']."<br></td>";
}
echo "</tr></table>";
}
while ($row = mysql_fetch_assoc($result)) { 
echo "<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['bhk']."<br></td>";
}
echo "</tr></table>";
exit;

and i have rent_table

CREATE TABLE `rent_table` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `location` varchar(40) NOT NULL,
  `area` varchar(40) NOT NULL,
  `bedroom` varchar(20) NOT NULL,
  `budget` varchar(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=58 ;

samething for sale_table

please help me where i am going wrong. Here is the error image i am getting this error:

error http://netelity.com/realestate/error.png

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:54:10+00:00Added an answer on May 28, 2026 at 1:54 am

    After any and all database queries, check if the query was actually successful and use the appropriate debugging functions to find why it wasn’t. Don’t just assume that it worked.

    $result = mysql_query(...);
    if (!$result) {
        echo mysql_error();
        die;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Actually I have two questions. (1) Is there any reduction in processing power or
I want to show the user detailed progress information when performing potentially lengthy database
Actually I can save it in swf and in avi formats. Is there any
Actually I created a button using the cobogw widget library. But the button does
I know there are actually a number of questions similar to this one, but
I'm developing ASP.NET in C# after performing aspnet_regsql on my database. I want to
Let's say we're tracking the times when a user is performing a certain action,
I don't want tools for actually performing refactorings, but tools for finding and suggesting
Actually in the center of current view, above all other objects. Cross-browser and without
Actually, I have the task of finding the employees based on the salary rank.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.