How to implement conditional screening for second-hand house rental network through the PHP program

Source: Internet
Author: User
How can I use the PHP program to implement conditional filtering similar to 58 through the PHP program? which of the following statements can be achieved through the stupid method, however, it is too time-consuming and there are more redundant code. I don't know which expert can offer a better solution. thank you!


Reply to discussion (solution)

Why is there no one?

What is a stupid method?

This requirement can be achieved by splicing filtering conditions, for example, when no conditions exist.

select * from tbl_name where 1=1 


If you select a region, the SQL statement becomes

select * from tbl_name where 1=1 and area = ”XXX“ 


After selecting a method, the SQL statement becomes

select * from tbl_name where 1=1 and area = ”XXX“ and type=1 


Multiple conditions are always placed after the SQL statement.

You can consider passing parameters through the URL, or directly writing a cookie or session, and then assembling an SQL statement for the existing data. I think so, but it depends on the requirements.

Few people answered.

No one. Which of the following heroes can help you? thank you.

In fact, this problem is very big, and both the server and client are involved.
The server mainly generates query statements.
How does the client determine the value passing style?
However, if you do not have any specific requirements, why can't you write a book?

Ajax or Frame click to submit once

Like this?
Then you can combine and assemble SQL statements.

In fact, this problem is very big, and both the server and client are involved.
The server mainly generates query statements.
How does the client determine the value passing style?
However, if you do not have any specific requirements, why can't you write a book?


I have already written it out, but now it's mainly about data splitting. you can check it at www.0971my.com/wskh.php?

We strongly recommend that you have php + sphinx

I used to get one. you just need to change it.

// Delete the GET parameter if (isset ($ _ GET ['AC']) {$ k = substr ($ _ GET ['AC'], 3 ); unset ($ _ GET ['AC']); if ($ k = 'all') $ _ GET = array (); else unset ($ _ GET [$ k]);}/* GET parameter */function getparam ($ k) {$ param = $ _ GET; if (isset ($ _ GET [$ k]) unset ($ param [$ k]); $ param [$ k] = ''; return http_build_query ($ param );}

This $ param usage, '. $ quyu ['title'].'
The rest is the SQL statement.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.