title: Getting a row count and returning it in a variable MySQL
body: <p>I have a problem where I am unable to return the number of rows in this table. I get an error when trying to store the row count in a variable and also get an error when I try to return it. This is a stored function in MySQL.</p>
  
  <p>I get the two errors:
  1.Not allowed to return a result set from a function
  2.ROW_COUNT Doesn't exist(isn't called)</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>BEGIN
  
  declare pageexists int;
  declare rowcount int;
  
  select distinct ITU from tblITU
  where ITU = inuser; 
  SET rowcount = COUNT(*) FROM tblITU;
  
  return rowcount;
  
  END
  </code></pre>
  
  <p>Thanks in advance!</p>