Documentation Menu

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 3 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 Manual arrow 11. API Reference arrow [REVIEW] database->loadObject

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

Last reviewed: Not reviewed
phpDocumentor

database->loadObject

Loads an object with fields from the first row returned by the current SQL query. If an object is passed as a parameter the fields of the row are bound to it and the updated object is returned.

Syntax

boolean loadObject ( object &$bind_object )

$bind_object
is the object that will be updated from the first row returned by the SQL query. If $bind_object is null then loadObject will create an object containing all fields from the first row of the SQL query.

Examples

Example: In this example we allow loadObject to create an object for us.

function getUser() {
  global $database;
 
  $sql = 'SELECT * FROM #__users';
  $database->setQuery( $sql );
  $user = NULL;
  $database->loadObject( $user );
  echo "Name: $user->name\n";
  echo "Username: $user->username\n";
 
}
 
getUser();

might produce:

Name: Administrator
Username: admin
 

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

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