title: timestamp on mysql query
body: <p>i have a search engine, which grabs links and titles from a mysql database and loops them into a page which matches what the user inputs. it is a query essentially and i would like to know how i could create a stamp which calculates a) how many rows are being returned and b) how long it took the query to return the results. any ideas?</p>
  
  <p>for example, if i input 'google' the search engine returns the results for 'Google', above the results however, in small writing, i would like it to show how long the query took, to about 4 decimal places and how many rows are being displayed. </p>
  
  <pre><code> $query = " SELECT * FROM scan WHERE "; 
  
  $terms = array_map('mysql_real_escape_string', $terms);
  $i = 0; 
  foreach ($terms as $each) {
        if ($i++ !== 0){
              $query .= " AND "; 
        }
        $query .= "keywords LIKE '%{$each}%'";
  }
  // Don't append the ORDER BY until after the loop
  $query .= "ORDER BY rank";
  
  
  
  $query = mysql_query($query) or die('MySQL Query Error: ' . mysql_error( $connect ));
  $numrows = mysql_num_rows($query);
  if ($numrows &gt; 0) {
          if ($k == "Paralympics 2012" ) {
                      echo "&lt;h1&gt; Paralympic Event: Archery  &lt;/h1&gt;";
                  }
                   if ($k == "paralympics 2012") {
                   echo "&lt;h1&gt; Paralympic Event: Archery &lt;/h1&gt;";
  
              }
        while ($row = mysql_fetch_assoc($query)) {
              $id = $row['id'];
              $title = $row['title'];
              $description = $row['description'];
              $keywords = $row['keywords'];
              $link = $row['link'];
              $rank = $row['rank'];
  </code></pre>