title: Same join query: two different results through Phalcon and phpMyAdmin
body: <p>I am working with php Phalcon framework. </p>
  
  <p>Query executed with phalcon:</p>
  
  <pre><code>$rawQuery = 
      'SELECT users.ID, users.Name, users.ProfilePictureUrl, users.Birthday, GetAge(users.Birthday) as Age, ' .
      '    users.Sex, users.LookingFor, commons.Name as CommonName, provinces.Name as ProvinceName, users.LastOnline FROM favorites ' .
      'INNER JOIN users ON favorites.FavoriteUserID = users.ID ' .
      'INNER JOIN commons ON commons.ID = users.CommonID ' .
      'INNER JOIN provinces ON provinces.ID = commons.ProvinceID ' .
      'WHERE favorites.OriginUserID = ' . $this-&gt;ID;
  return $this-&gt;getReadConnection()-&gt;query($rawQuery)-&gt;fetchAll();
  </code></pre>
  
  <p>This query returns all the fields correctly, except CommonName, which should be a string 'Aglié', but is null. Sample output:</p>
  
  <pre><code>[{"ID":"2","0":"2","Name":"Olga","1":"Olga","ProfilePictureUrl":"asd","2":"asd","Birthday":"2014-07-09","3":"2014-07-09","Sex":"f","4":"f","LookingFor":"girls","5":"girls","CommonName":null,"6":null,"ProvinceName":"Torino","7":"Torino","LastOnline":null,"8":null}]
  </code></pre>
  
  <p>On the other hand, the same query executed through phpMyAdmin:</p>
  
  <pre><code>SELECT users.ID, users.Name, users.ProfilePictureUrl, users.Birthday, GetAge(users.Birthday) as Age,
      users.Sex, users.LookingFor, commons.Name as CommonName, provinces.Name as ProvinceName, users.LastOnline FROM favorites
  INNER JOIN users ON favorites.FavoriteUserID = users.ID 
  INNER JOIN commons ON commons.ID = users.CommonID
  INNER JOIN provinces ON provinces.ID = commons.ProvinceID
  WHERE favorites.OriginUserID = 1
  </code></pre>
  
  <p>it hangs indefinitely. However, if I take out the Age field, it returns all the correct fields, including CommonName (a valid string). Sample output:</p>
  
  <pre><code>ID, Name, ProfilePictureUrl, Birthday, Sex, LookingFor, CommonName, ProvinceName, LastOnline
  2, Olga, asd, 2014-07-09, f, girls, Agliè, Torino, NULL
  </code></pre>
  
  <p>GetAge(birthday) is defined as follows:</p>
  
  <pre><code>return DATE_FORMAT(FROM_DAYS(DATEDIFF(curdate(),birthday)), '%Y')
  </code></pre>
  
  <p>You can assume for simplicity that there are only 4 tables users, favorites, commons and provinces, with only those fields used in the query. Anything other is not useful.</p>
  
  <p>It makes absolutely no sense to me... Please help!</p>
  
  <p>Apache version 2.4.4</p>
  
  <p>PHP version 5.4.12</p>
  
  <p>MySql version 5.6.12</p>
  
  <p>Phalcon version 1.3.2</p>
  
  <p>Windows 7 64-bit operative system</p>