Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Between Syntax

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
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);

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.
 
the BETWEEN clause has following syntax

column BTEWEEN min_value AND max_value

so your query should be

SELECT * FROM details WHERE category2='south' and price BETWEEN '$pricerangel' and '$pricerangeh'

hope that helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top