title: PHP - Mysql_num_rows on result in function (OOP)
body: <p>I'm trying with some OOP and got a problem with making a mysql_num_rows on a query in a function. I got a function looking like this: </p>
  
  <pre><code>    function userPush()
  {
      $sql = ("SELECT *
                  FROM pushComments
                  WHERE pushCommentsFromProfileId='$_SESSION[userId]'
              ");
      $result = mysql_query($sql)or die(mysql_error());
  
      $userPush = Array();
  
      while($row = mysql_fetch_assoc($result)):
  
          $userPush[$row['pushCommentsId']]['pushCommentsId'] = $row['pushCommentsId'];
          $userPush[$row['pushCommentsId']]['pushCommentsTimestamp'] = $row['pushCommentsTimestamp'];
          $userPush[$row['pushCommentsId']]['pushCommentsFromProfile'] = $row['pushCommentsFromProfile'];
          $userPush[$row['pushCommentsId']]['pushCommentsFromProfileId'] = $row['pushCommentsFromProfileId'];
          $userPush[$row['pushCommentsId']]['pushCommentsContent'] = $row['pushCommentsContent'];
  
      endwhile;
  
      return $userPush;
  }
  //
  </code></pre>
  
  <p>And calling the function like this: </p>
  
  <pre><code>$db -&gt; New woko();
  $pushComments = $db-&gt;pushComments();
  </code></pre>
  
  <p>How would I create a mysql_num_rows here? Can I call a $count variable from the function, and how?</p>