Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Query using some sort of range feature - matching dropdown incremental value to database
    primarykey
    data
    text
    <p>Not sure what to search for when solving this puzzle. Not asking for the world... just direction unless you're feeling generous. This is going to be terribly hard to expain.</p> <p>My website has dropdown menus with measurements. When selecting width x height dropdowns, it checks database for price. Currently widths and heights were specific in the DATABASE such as 24, 28, 32, 36. So I just pulled the measurements from a query loop into my list... and voila it matches and echos a price.. but..</p> <p>Now I'm finding out that the measurements listed will need to be in 1" increments. So, I only have a database with specific measurements but I need the entire measurement range.</p> <p>Do I really have to go into the DATABASE and manually enter the SAME price for 24", 25", 26", 27"... and SAME price for 28", 29", 30", 31", ... and do this time hundreds of products? </p> <p>Or is there a SQL trick that allows me to select the minimum and maximum measurement, list them in a dropdown, then match one of those 1" increment measurements that isn't exactly what the DATABASE says... but is between (for example) 24" and 28". </p> <p>Hope this isn't too confusing and THANK YOU. </p> <p>Thanks to Gordon this was much easier than anticipated. I made it more complicated than it should have been.</p> <p>Code that worked:</p> <pre><code>SELECT * FROM price_dimensions WHERE prodid = '".$_POST['prodid']."' AND height &gt;= '".$_POST['heightX']."' AND width &gt;= '".$_POST['widthX']."' ORDER BY height ASC, width ASC LIMIT 1 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload