?
Solved

Query Issue: 2 form fields with min and max.

Posted on 2006-11-29
1
Medium Priority
?
166 Views
Last Modified: 2013-12-24
I keep getting the error: Syntax error (Missing operator) when I add 2 forms.  

search page---

      <select name="minprice">
      <option value="1"> no min </option>
            <option value="300000"> 300,000 </option>
      </select>  max

                 <select name="maxprice">
      <option value="9999999999"> no max </option>
      <option> 400,000 </option>

action page---

SELECT reals_id, zip.zip, city.city, state.state, price
FROM reals, zip, city, state
WHERE (0=0)
      AND reals.city = city.city_id
      AND reals.state = state.state_id
      AND reals.zip=zip.zip_id
-------------------------------------------------------------------
      AND reals.price GTE '#Session.minprice#'
      AND reals.price LTE '#Session.maxprice#'
--------------------------------------------------------------------
      AND city.city LIKE '#Session.scity#%'
      AND state.state LIKE '#Session.sstate#%'
      AND zip.zip LIKE '#Session.szip#%'

It works fine without the 2 lines of code in between the dashes...
I have a hunch I need to convert string to number

Any help will be greatly appreciated.




                        
0
Comment
Question by:sjha81
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 25

Accepted Solution

by:
dgrafx earned 2000 total points
ID: 18035576
1) in your db - is the field reals.price a datatype of money?
if yes, then remove the ' ' from around the value
the only time you'd use ' ' around the value is if it's a varchar or text field.
2) are you setting your session.minprice & session.maxprice before the code shown here (on action page)
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question