Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

redirect from results page PHP

New Here ,
Nov 01, 2007 Nov 01, 2007
Hi There

I have a Real Estate search page with two drop down menus, Bedrooms and Bathrooms that allows a user to search for houses by selecting the number of bedrooms and or bathrooms they would like. the numbers chosen by the user are passed to results.php using the POST method and all property meeting the search is shown.

On the page results.php the numbers chosen by the users are put into two variables "beds" and "baths"
Here is the SQL from the recordset

SELECT bedrooms, bathrooms, smallPhoto, `desc`,address
FROM property
WHERE bedrooms LIKE beds AND bathrooms LIKE baths
ORDER BY bedrooms DESC

for example the search is made for 1 bedroom 1 bathroom. Several properties that fit the criteria are shown.

Where property meets the search criteria all is well, however when someone searches for a 1 bedroom 3 bathroom property and none are found in the database the results page is still shown but with all the fields blank.

What I would like to do is display another page other than the results page saying something along the lines of "Sorry there are no matching properties", how do I do this?

Thanks
TOPICS
Server side applications
258
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Nov 01, 2007 Nov 01, 2007
lamanchicaone wrote:
> Where property meets the search criteria all is well, however when someone
> searches for a 1 bedroom 3 bathroom property and none are found in the database
> the results page is still shown but with all the fields blank.

Use the Show if Recordset is Empty and Show if Recordset is Not Empty
server behaviors to display alternative content. If the query produces
no results, just display "No matching records found" on the same page.

--
David Powers, Adobe Community Exp...
Translate
LEGEND ,
Nov 01, 2007 Nov 01, 2007
lamanchicaone wrote:
> Where property meets the search criteria all is well, however when someone
> searches for a 1 bedroom 3 bathroom property and none are found in the database
> the results page is still shown but with all the fields blank.

Use the Show if Recordset is Empty and Show if Recordset is Not Empty
server behaviors to display alternative content. If the query produces
no results, just display "No matching records found" on the same page.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 01, 2007 Nov 01, 2007
LATEST
thank you so much for your quick and 100% correct answer.

many thanks
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines