Results 1 to 3 of 3

Thread: Between syntax

  1. #1
    Join Date
    Aug 2002
    Posts
    1

    Question Unanswered: Between syntax

    Hi, I've got this code:

    $number_of_records=mysql_query("SELECT * FROM details WHERE category2='south' and price = BETWEEN '$pricerangel' and '$pricerangeh'");
    $number_of_records_in_table = mysql_num_rows($number_of_records);

    and it gives: Warning: Supplied argument is not a valid MySQL result resource in etc etc. It's the BETWEEN statement thats causing the trouble but the mysql manual doesn't make the syntax clear to me. I'm a bit lost here.

    Many thanks for any pointers.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    remove the equal sign before the BETWEEN keyword, and if the price column is defined numeric, you'll probably want to remove the single quotes from the price range amounts (i believe mysql lets you get away with it, but mysql is notoriously liberal with its syntax)

    rudy
    http://rudy.ca/

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    The following links may be helpful for you in the future:

    link1

    link2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •