title: $wpdb query not working in plugin
body: <p>I'm trying to do a reviews plugin in Wordpress, and one of the thing that my client asked me to do was that a user should be able to rate only one product every 24 horas, so I have to establish a limit between rates. </p>
  
  <p>And I made this function to check if the limit is reached: </p>
  
  <pre><code>function isAllowedToRate(){
  
          global $wpdb;
          $currentDate = date('Y-m-d');
          $userId = get_current_user_id();
          $table_name = $wpdb-&gt;prefix .'esvn_reviews';
          $isAllowed = $wpdb-&gt;get_results( 
                  "
                  SELECT user_id, fecha_calificacion 
                  FROM {$table_name}
                  WHERE user_id = {$userId} 
                      AND review_date = {$currentDate}
                  "
              );
  
          if( count( $isAllowed &gt; 0 ) ){
  
              return false;
  
          }else{
  
              return true;
          }
  
      }
  </code></pre>
  
  <p>But every time I try to run it, it returns false, the error that I'm getting from Wordpress is this:</p>
  
  <pre><code> &lt;div id='error'&gt;
              &lt;p class='wpdberror'&gt;&lt;strong&gt;WordPress database error:&lt;/strong&gt; []&lt;br /&gt;
              &lt;code&gt;
              SELECT user_id, fecha_calificacion 
              FROM wp_esvn_reviews
              WHERE user_id = 6 
                  AND fecha_calificacion = 2015-10-30
              &lt;/code&gt;&lt;/p&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>If I take the same SQL and run it directly into the database, it works like a charm, but I keep getting this error from Wordpress and the function always returns false.</p>