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 16 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->explain

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

Last reviewed: Not reviewed


This is a diagnostic function that performs an SQL EXPLAIN on the current SQL query string.  The result is returned in an HTML table.


string explain ( )



$query = "SELECT id"
       . "\n FROM #__menu"
       . "\n WHERE menutype='mainmenu'"
       . "\n AND published='1'"
       . "\n ORDER BY parent, ordering";
$database->setQuery( $query );
echo $database->explain ();

might output:

<div style="background-color:#FFFFCC" align="left">
<table cellspacing="1" cellpadding="2" border="0" bgcolor="#000000" align="center">
 FROM mos_menu
 WHERE menutype='mainmenu'
 AND published='1'
 ORDER BY parent, ordering</pre>
  <th bgcolor="#ffffff">table</th><th bgcolor="#ffffff">type</th>
  <th bgcolor="#ffffff">possible_keys</th>
  <th bgcolor="#ffffff">key</th>
  <th bgcolor="#ffffff">key_len</th>
  <th bgcolor="#ffffff">ref</th>
  <th bgcolor="#ffffff">rows</th>
  <th bgcolor="#ffffff">Extra</th>
  <td bgcolor="#ffffff">mos_menu</td>
  <td bgcolor="#ffffff">ref</td>
  <td bgcolor="#ffffff">menutype</td>
  <td bgcolor="#ffffff">menutype</td>
  <td bgcolor="#ffffff">26</td>
  <td bgcolor="#ffffff">const</td>
  <td bgcolor="#ffffff">13</td>
  <td bgcolor="#ffffff">where used; Using filesort</td>
<br /> </div>

which renders as:

 FROM mos_menu
 WHERE menutype='mainmenu'
 AND published='1'
 ORDER BY parent, ordering
mos_menurefmenutypemenutype26const13where used; Using filesort


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

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