Actions

API16

Difference between revisions of "JDatabaseMySQL/explain"

From Joomla! Documentation

< API16:JDatabaseMySQL
(New page: ===Description=== Diagnostic function <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </s...)
 
m (removing red link to edit, no existant pages)
 
Line 3: Line 3:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JDatabaseMySQL/explain|Edit Descripton]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
  
{{Description:JDatabaseMySQL/explain}}
+
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 59: Line 59:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JDatabaseMySQL/explain|Edit See Also]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
{{SeeAlso:JDatabaseMySQL/explain}}
+
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
Line 74: Line 74:
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API16]]

Latest revision as of 21:59, 12 May 2013

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Diagnostic function

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

explain()


Returns

string

Defined in

libraries/joomla/database/database/mysql.php

Importing

jimport( 'joomla.database.database.mysql' );

Source Body

public function explain()
{
        $temp = $this->_sql;
        $this->_sql = "EXPLAIN $this->_sql";
 
        if (!($cur = $this->query())) {
                return null;
        }
        $first = true;
 
        $buffer = '<table id="explain-sql">';
        $buffer .= '<thead><tr><td colspan="99">'.$this->getQuery().'</td></tr>';
        while ($row = mysql_fetch_assoc($cur)) {
                if ($first) {
                        $buffer .= '<tr>';
                        foreach ($row as $k=>$v) {
                                $buffer .= '<th>'.$k.'</th>';
                        }
                        $buffer .= '</tr></thead><tbody>';
                        $first = false;
                }
                $buffer .= '<tr>';
                foreach ($row as $k=>$v) {
                        $buffer .= '<td>'.$v.'</td>';
                }
                $buffer .= '</tr>';
        }
        $buffer .= '</tbody></table>';
        mysql_free_result($cur);
 
        $this->_sql = $temp;
 
        return $buffer;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />