title: MYSQL using php won't rank data, while Root mysql user does
body: <p>My rank calculating query </p>
  
  <pre><code>SELECT @i := @i +1 AS rank, t . * 
  FROM groups t, ( 
  
  SELECT @i :=0 
  )foo 
  
  WHERE ( 
  t.group_id = '1' 
  ) 
  ORDER BY t.views DESC 
  )r 
  WHERE r.id =4
  </code></pre>
  
  <p>Logged in as root in phpmyadmin, it calculates everything properly. Using php's mysql account through php, the output isn't calculated correctly. It doesn't calculate the rank, it fetches all rows, finds the row number of the ID i gave it, then it returns the row number's location in regards to to all the rows before it.</p>
  
  <p>So if there are 5 rows, and r.id = 4 is in the 4th row in the table, it disregards the order by t.views, and just tells me id #4 is  4th one in table. r.id = 1000 is 1000th in table. It won't tell me its rank. When I run the query as root, it tells me the rank correctly. </p>
  
  <p>I'm assuming there is some sort of permission that needs to be granted for the php mysql user to be allowed to use the @'s? That's my only logical explanation for it, it seems it's disregarding the logic. Anyone know what the permission is?</p>