title: How to create custom MySQL queries in CakePHP?
body: <p>I am trying to create my own MySQL queries in Cakephp. </p>
  
  <p>This is my <code>LocationsController.php</code>:</p>
  
  <pre><code>&lt;?php
  App::uses('Location', 'Model');
  class LocationsController extends AppController
  {
      public $helpers = array('Html', 'Form');
      function index()
      {
          $this-&gt;loadModel("Location");
          $this-&gt;Location-&gt;get();
      }
  }
  </code></pre>
  
  <p>This is my <code>LocationModel.php</code>:</p>
  
  <pre><code>&lt;?php
  App::uses('AppModel', 'Model');
  class LocationModel extends Model {
  
      public $name = 'Location';
  
      public function get()
      {
          $this-&gt;Location-&gt;query("SELECT * FROM locations;");
      }
  }
  </code></pre>
  
  <p>As you can see, I am just trying to perform a simple query but it doesn't work. I get this error: </p>
  
  <pre><code>Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error 
  in your SQL syntax; check the manual that corresponds to your MySQL server 
  version for the right syntax to use near 'get' at line 1
  </code></pre>
  
  <p>When I use one of the magic methods like find("all") instead, it works...</p>
  
  <p>Can you see what the problem is? I really can't and I'm only trying to do a simple task!</p>