Answers.Body: <p>As per:
  <a href="https://craftcms.stackexchange.com/questions/22593/query-entries-between-two-values?rq=1">Query entries between two values</a>
  I found that enclosing the query string that I had with [ ] to make it a sub-array, works:</p>
  
  <pre><code>        {% set entries = craft.entries({
              section: 'listing',
              listinglatitudenumber: ['and', '&gt;=' ~ pluginResults.latmin, '&lt;=' ~ pluginResults.latmax]
          }) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T20:22:09.053Z
Answers.LastActivityDate: 2018-04-22T20:22:09.053Z
Answers.UserDisplayName: ironfish
Answers.Body: <p>You need to separate your criterias with commas</p>
  
  <pre><code>listinglatitudenumber: 'and, ' ~  '&gt;=' ~ pluginResults.latmin ~ ', &lt;=' ~ pluginResults.latmin, 
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T19:44:26.613Z
Answers.Text: Thanks Robin once again for your help :)
  With the above syntax I get:
  
  
  Internal Server Error
  
  A hash value must be followed by a comma. Unexpected token "string" of value ", <=" ("punctuation" expected with value ",").
  
  And I am trying to understand exactly what you mean, and trying to resolve the error, but not successful - could you explain further?
Answers.UserDisplayName: ironfish
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T19:56:13.700Z
Answers.Text: Of course you need to place a last comma since you are inside an object. Please read this https://craftcms.stackexchange.com/a/25774/5557 you can either separate your values via comma or you use an array from the beginning
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T20:08:30.067Z
Answers.Text: Thank you I will look at the examples and try to get it working :)
Answers.UserDisplayName: ironfish
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T20:09:52.870Z
Answers.Text: Let me know if you need further help. You simply need to convert PHP string separators `.` with twig `~`
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T20:26:30.057Z
Answers.Text: Thank you Robin again for your time and effort on this. :)
Answers.UserDisplayName: ironfish
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-09T17:12:38.617Z
Answers.Text: Hi Robin, At the time you provided your answer using commas, I was not able to get that to work and so I found another way to do it using [ ]. I now see that using commas would also work - I did not mean to diminish your answer. Thanks again.
Answers.UserDisplayName: ironfish
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T19:35:24.457Z
Answers.LastActivityDate: 2018-04-22T20:00:13.300Z
Answers.LastEditDate: 2018-04-22T20:00:13.300Z
Answers.UserDisplayName: Robin Schambach
Body: <p>This works:</p>
  
  <pre><code>            {% set entries = craft.entries({
                  section: 'listing',
                  listinglatitudenumber: '&gt;=' ~ pluginResults.latmin
              }) %}
  </code></pre>
  
  <p>But I need to do this:</p>
  
  <pre><code>            {% set entries = craft.entries({
                  section: 'listing',
                  listinglatitudenumber: 'and', '&gt;=' ~ pluginResults.latmin, '&lt;=' ~ pluginResults.latmax
              }) %}
  </code></pre>
  
  <p>And I cannot for the life of me figure out the correct syntax for this.</p>
  
  <p>I have been trying many different combos for the 'and' statement based on other answers I have seen in the Craft Stack Exchange but have not been successful. I have not been able to find any docs on this type of query.</p>
  
  <p>Any help much appreciated :)</p>
  
Tags: <craft.entries>
Title: ANDing criteria in craft.entries
ThreadText: # ANDing criteria in craft.entries
  
  (Asked by: username_0 on 2018-04-22)
  
  This works:
  
  ```
              {% set entries = craft.entries({
                  section: 'listing',
                  listinglatitudenumber: '>=' ~ pluginResults.latmin
              }) %}
  
  ```
  
  But I need to do this:
  
  ```
              {% set entries = craft.entries({
                  section: 'listing',
                  listinglatitudenumber: 'and', '>=' ~ pluginResults.latmin, '<=' ~ pluginResults.latmax
              }) %}
  
  ```
  
  And I cannot for the life of me figure out the correct syntax for this.
  
  I have been trying many different combos for the 'and' statement based on other answers I have seen in the Craft Stack Exchange but have not been successful. I have not been able to find any docs on this type of query.
  
  Any help much appreciated :)
  
  **Tags:** craft.entries
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2018-04-22. Score: 0 | Accepted answer
  
  As per:
  [Query entries between two values](https://craftcms.stackexchange.com/questions/22593/query-entries-between-two-values?rq=1)
  I found that enclosing the query string that I had with [ ] to make it a sub-array, works:
  
  ```
          {% set entries = craft.entries({
              section: 'listing',
              listinglatitudenumber: ['and', '>=' ~ pluginResults.latmin, '<=' ~ pluginResults.latmax]
          }) %}
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2018-04-22. Score: 1
  
  You need to separate your criterias with commas
  
  ```
  listinglatitudenumber: 'and, ' ~  '>=' ~ pluginResults.latmin ~ ', <=' ~ pluginResults.latmin, 
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks username_1 once again for your help :) With the above syntax I get:   Internal Server Error  A hash value must be followed by a comma. Unexpected token "string" of value ", <=" ("punctuation" expected with value ",").  And I am trying to understand exactly what you mean, and trying to resolve the error, but not successful - could you explain further?  
  > **username_1**: Of course you need to place a last comma since you are inside an object. Please read this https://craftcms.stackexchange.com/a/25774/5557 you can either separate your values via comma or you use an array from the beginning  
  > **username_0**: Thank you I will look at the examples and try to get it working :)  
  > **username_1**: Let me know if you need further help. You simply need to convert PHP string separators `.` with twig `~`  
  > **username_0**: Thank you username_1 again for your time and effort on this. :)  
  > **username_0**: Hi username_1, At the time you provided your answer using commas, I was not able to get that to work and so I found another way to do it using [ ]. I now see that using commas would also work - I did not mean to diminish your answer. Thanks again.  
  
  ---
  
  