ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How do I pass Form GET variables into URL Segments?

April 09, 2011 8:51am

Subscribe [4]
  • #16 / Apr 11, 2011 4:45pm

    bgarrant

    356 posts

    I could not get the conditionals to work when building the SQL query.  Do you have an example so I can see how it works?  I figured there must be a way to do something like this so the $sql variable keeps building?

    if(isset($_GET['mls']) AND trim($_GET['mls']) != '') {
        $mls = mysql_real_escape_string(trim($_GET['mls']);
        $sql = "MLSNum = echo $mls OR " 
    }  
    
    if(isset($_GET['lowprice']) AND trim($_GET['lowprice']) != '') {
        $lowprice = mysql_real_escape_string(trim($_GET['lowprice']);
        $sql = sql . "((ListPr >= echo $lowprice AND ListPr <= echo $highprice) OR " 
    } 
    
    {exp:query limit=“10” paginate=“both” sql=“SELECT * FROM listings WHERE $sql ORDER BY ListPr ASC”}
  • #17 / Apr 11, 2011 6:01pm

    Rick Jolly

    729 posts

    There are some obvious errors in your code that you are going to have to work out yourself

    $sql = sql . "((ListPr >= echo $lowprice AND ListPr <= echo $highprice) OR "

    Like no “echo” required, and one of your $sql variables is missing the “$” .

    Also, you need to initialize your $sql variable outside the conditionals.

  • #18 / Jan 14, 2012 10:07pm

    kaizendc

    16 posts

    seems like it won’t work, I’ve already tried that query and it will have an error result

    the $sql here
    {exp:query limit=“10” paginate=“both” sql=“SELECT * FROM listings WHERE $sql ORDER BY ListPr ASC”}

    I think you cannot just place a $sql inside {exp:query} tags?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases