Jump to content

Greater Than or Equal to AND Less Than or Equal To Not Working


rurede05

Recommended Posts

I am sure there is a very simple answer to this question but I am not very good at coding php.

 

Situation:

I have an online form that queries a MySql db by the first three digits of zipcode.  I have certain information that goes out depending on the range of the zipcode.

 

Example:

User types 45678 in the ZipCode space on our form.

On submission, it then queries the db to find out what information needs to be emailed that pertains to the first three digits of that zipcode in this case 456.

 

On the db there I have a range for the zipcodes. 

From 456-499 send X information...

From 500-567 send Y information...

etc.

 

My Dilemma:

The code reads as follows:

"SELECT `information` FROM tableName WHERE '$ZipCode' >= ZipCodeStart AND '$ZipCode' <= ZipCodeFinish";

 

Big problem:

When I test the last number in the range (499 or 567) in our example above.  It spits out a generic e-mail instead of the detailed e-mail with the data that is stored in the database.  Not a problem except that it should spit out the detail data since it is stored and programmed to do that.

 

Any number that lands between the range (say 460 again with the example numbers above) everything works fine.  It only spits out the generic email with the last numbers of the ranges.

 

I am confused because the >= and the <= should handle those easily correct? Am I overthinking/looking something?

 

Thanks for your help in advance.

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.