1.5 Template Project

The Joomla! Documentation Working Group is running a project to develop detailed reference and tutorial material on Joomla! 1.5 templates.  There is a project page on the documentation wiki where you can see the work in progress and help us by contributing your knowledge.

Who's Online

We have 8 guests online

Help Site License

The Joomla! Help Site content is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution NonCommercial ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Home arrow Developer Manual arrow 11. API Reference arrow [REVIEW] database->getNumRows

[REVIEW] database->getNumRows PDF Print E-mail

Last reviewed: Not reviewed
phpDocumentor

database->getNumRows

Returns the number of rows returned by the most recent database query or from a specified database resource.

Syntax

int getNumRows ( [ object $resource] )

$resource
is a database resource object.  This parameter is optional and if omitted the function will return the number of rows from the most recent database query.

Examples

Example: A function to count the number of registered users.  Of course, this function could be performed more efficiently using a "SELECT count(*) FROM #__users" query.

// Return total number of users registered on the site.
function countUsers() {
  global $database;
 
  $database->setQuery( "SELECT id FROM #__users" );
  if (!$database->query()) {
    echo $database->stderr();
    return false;
  }
  return $database->getNumRows();
}

Please report any errors on this page to the Developer Documentation Forum.

 

Last Updated ( Monday, 25 December 2006 )
 
< Prev   Next >