Location: PHPKode > scripts > PHP DB Script > html_docs/classDB.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>db.class.php: DB class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.3 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Compound&nbsp;List</a> | <a class="qindex" href="functions.html">Compound&nbsp;Members</a></div>
<h1>DB Class Reference</h1><a href="classDB-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a0">DB</a> ($base, $server, $user, $pass)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a1">query</a> ($query, $debug=-1)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a2">execute</a> ($query, $debug=-1)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a3">fetchNextObject</a> ($result=NULL)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a4">numRows</a> ($result=NULL)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a5">queryUniqueObject</a> ($query, $debug=-1)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a6">queryUniqueValue</a> ($query, $debug=-1)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a7">maxOf</a> ($column, $table, $where)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a8">maxOfAll</a> ($column, $table)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a9">countOf</a> ($table, $where)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a10">countOfAll</a> ($table)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a11">debugAndDie</a> ($query)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a12">debug</a> ($debug, $query, $result=NULL)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a13">debugQuery</a> ($query, $reason="Debug")</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a14">debugResult</a> ($result)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a15">getExecTime</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a16">getQueriesCount</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a17">resetFetch</a> ($result)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a18">lastInsertedId</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a19">close</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#a20">getMicroTime</a> ()</td></tr>

<tr><td colspan=2><br><h2>Public Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#o0">$defaultDebug</a> = false</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#o1">$mtStart</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#o2">$nbQueries</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classDB.html#o3">$lastResult</a></td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A PHP class to access MySQL database with convenient methods in an object oriented way, and with a powerful debug system.<br>
 Licence: LGPL <br>
 Web site: <a href="http://slaout.linux62.org/">http://slaout.linux62.org/</a> <dl compact><dt><b>Version:</b></dt><dd>1.0 </dd></dl>
<dl compact><dt><b>Author:</b></dt><dd>S&eacute;bastien Lao&ucirc;t (<a href="mailto:hide@address.com">hide@address.com</a>) </dd></dl>

<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a name="a0" doxytag="DB::DB"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::DB </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname" nowrap> <em>base</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>server</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>user</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>pass</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Connect to a MySQL database to be able to use the methods below.     </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a name="a19" doxytag="DB::close"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::close </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Close the connexion with the database server.<br>
 It's usually unneeded since PHP do it automatically at script end.     </td>
  </tr>
</table>
<a name="a9" doxytag="DB::countOf"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::countOf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname" nowrap> <em>table</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>where</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get the count of rows in a table, with a condition. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$table</em>&nbsp;</td><td>The table where to compute the number of rows. </td></tr>
    <tr><td valign=top><em>$where</em>&nbsp;</td><td>The condition before to compute the number or rows. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>The number of rows (0 or more). </dd></dl>
    </td>
  </tr>
</table>
<a name="a10" doxytag="DB::countOfAll"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::countOfAll </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>table</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get the count of rows in a table. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$table</em>&nbsp;</td><td>The table where to compute the number of rows. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>The number of rows (0 or more). </dd></dl>
    </td>
  </tr>
</table>
<a name="a12" doxytag="DB::debug"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::debug </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname" nowrap> <em>debug</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>query</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>result</em> = NULL</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Internal function to debug a MySQL query.<br>
 Show the query and output the resulting table if not NULL. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$debug</em>&nbsp;</td><td>The parameter passed to <a class="el" href="classDB.html#a1">query()</a> functions. Can be boolean or -1 (default). </td></tr>
    <tr><td valign=top><em>$query</em>&nbsp;</td><td>The SQL query to debug. </td></tr>
    <tr><td valign=top><em>$result</em>&nbsp;</td><td>The resulting table of the query, if available. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a name="a11" doxytag="DB::debugAndDie"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::debugAndDie </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>query</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Internal function to debug when MySQL encountered an error, even if debug is set to Off. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$query</em>&nbsp;</td><td>The SQL query to echo before diying. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a name="a13" doxytag="DB::debugQuery"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::debugQuery </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname" nowrap> <em>query</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>reason</em> = "Debug"</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Internal function to output a query for debug purpose.<br>
 Should be followed by a call to <a class="el" href="classDB.html#a14">debugResult()</a> or an echo of "&lt;/div&gt;". <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$query</em>&nbsp;</td><td>The SQL query to debug. </td></tr>
    <tr><td valign=top><em>$reason</em>&nbsp;</td><td>The reason why this function is called: "Default Debug", "Debug" or "Error". </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a name="a14" doxytag="DB::debugResult"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::debugResult </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>result</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Internal function to output a table representing the result of a query, for debug purpose.<br>
 Should be preceded by a call to <a class="el" href="classDB.html#a13">debugQuery()</a>. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$result</em>&nbsp;</td><td>The resulting table of the query. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a name="a2" doxytag="DB::execute"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::execute </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname" nowrap> <em>query</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>debug</em> = -1</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Do the same as <a class="el" href="classDB.html#a1">query()</a> but do not return nor store result.<br>
 Should be used for INSERT, UPDATE, DELETE... <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$query</em>&nbsp;</td><td>The query. </td></tr>
    <tr><td valign=top><em>$debug</em>&nbsp;</td><td>If true, it output the query and the resulting table. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a name="a3" doxytag="DB::fetchNextObject"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::fetchNextObject </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>result</em> = NULL          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Convenient method for mysql_fetch_object(). <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$result</em>&nbsp;</td><td>The ressource returned by <a class="el" href="classDB.html#a1">query()</a>. If NULL, the last result returned by <a class="el" href="classDB.html#a1">query()</a> will be used. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>An object representing a data row. </dd></dl>
    </td>
  </tr>
</table>
<a name="a15" doxytag="DB::getExecTime"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::getExecTime </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get how many time the script took from the begin of this object. <dl compact><dt><b>Returns:</b></dt><dd>The script execution time in seconds since the creation of this object. </dd></dl>
    </td>
  </tr>
</table>
<a name="a20" doxytag="DB::getMicroTime"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::getMicroTime </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Internal method to get the current time. <dl compact><dt><b>Returns:</b></dt><dd>The current time in seconds with microseconds (in float format). </dd></dl>
    </td>
  </tr>
</table>
<a name="a16" doxytag="DB::getQueriesCount"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::getQueriesCount </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get the number of queries executed from the begin of this object. <dl compact><dt><b>Returns:</b></dt><dd>The number of queries executed on the database server since the creation of this object. </dd></dl>
    </td>
  </tr>
</table>
<a name="a18" doxytag="DB::lastInsertedId"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::lastInsertedId </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get the id of the very last inserted row. <dl compact><dt><b>Returns:</b></dt><dd>The id of the very last inserted row (in any table). </dd></dl>
    </td>
  </tr>
</table>
<a name="a7" doxytag="DB::maxOf"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::maxOf </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname" nowrap> <em>column</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>table</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>where</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get the maximum value of a column in a table, with a condition. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$column</em>&nbsp;</td><td>The column where to compute the maximum. </td></tr>
    <tr><td valign=top><em>$table</em>&nbsp;</td><td>The table where to compute the maximum. </td></tr>
    <tr><td valign=top><em>$where</em>&nbsp;</td><td>The condition before to compute the maximum. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>The maximum value (or NULL if result is empty). </dd></dl>
    </td>
  </tr>
</table>
<a name="a8" doxytag="DB::maxOfAll"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::maxOfAll </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname" nowrap> <em>column</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>table</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get the maximum value of a column in a table. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$column</em>&nbsp;</td><td>The column where to compute the maximum. </td></tr>
    <tr><td valign=top><em>$table</em>&nbsp;</td><td>The table where to compute the maximum. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>The maximum value (or NULL if result is empty). </dd></dl>
    </td>
  </tr>
</table>
<a name="a4" doxytag="DB::numRows"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::numRows </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>result</em> = NULL          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get the number of rows of a query. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$result</em>&nbsp;</td><td>The ressource returned by <a class="el" href="classDB.html#a1">query()</a>. If NULL, the last result returned by <a class="el" href="classDB.html#a1">query()</a> will be used. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>The number of rows of the query (0 or more). </dd></dl>
    </td>
  </tr>
</table>
<a name="a1" doxytag="DB::query"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::query </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname" nowrap> <em>query</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>debug</em> = -1</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Query the database. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$query</em>&nbsp;</td><td>The query. </td></tr>
    <tr><td valign=top><em>$debug</em>&nbsp;</td><td>If true, it output the query and the resulting table. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>The result of the query, to use with <a class="el" href="classDB.html#a3">fetchNextObject()</a>. </dd></dl>
    </td>
  </tr>
</table>
<a name="a5" doxytag="DB::queryUniqueObject"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::queryUniqueObject </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname" nowrap> <em>query</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>debug</em> = -1</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get the result of the query as an object. The query should return a unique row.<br>
 Note: no need to add "LIMIT 1" at the end of your query because the method will add that (for optimisation purpose). <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$query</em>&nbsp;</td><td>The query. </td></tr>
    <tr><td valign=top><em>$debug</em>&nbsp;</td><td>If true, it output the query and the resulting row. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>An object representing a data row (or NULL if result is empty). </dd></dl>
    </td>
  </tr>
</table>
<a name="a6" doxytag="DB::queryUniqueValue"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::queryUniqueValue </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname" nowrap> <em>query</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>debug</em> = -1</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get the result of the query as value. The query should return a unique cell.<br>
 Note: no need to add "LIMIT 1" at the end of your query because the method will add that (for optimisation purpose). <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$query</em>&nbsp;</td><td>The query. </td></tr>
    <tr><td valign=top><em>$debug</em>&nbsp;</td><td>If true, it output the query and the resulting value. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>A value representing a data cell (or NULL if result is empty). </dd></dl>
    </td>
  </tr>
</table>
<a name="a17" doxytag="DB::resetFetch"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::resetFetch </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>result</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Go back to the first element of the result line. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>$result</em>&nbsp;</td><td>The resssource returned by a <a class="el" href="classDB.html#a1">query()</a> function. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<hr><h2>Member Data Documentation</h2>
<a name="o0" doxytag="DB::$defaultDebug"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::$defaultDebug = false
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Put this variable to true if you want ALL queries to be debugged by default:     </td>
  </tr>
</table>
<a name="o3" doxytag="DB::$lastResult"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::$lastResult
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
INTERNAL: The last result ressource of a <a class="el" href="classDB.html#a1">query()</a>.     </td>
  </tr>
</table>
<a name="o1" doxytag="DB::$mtStart"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::$mtStart
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
INTERNAL: The start time, in miliseconds.     </td>
  </tr>
</table>
<a name="o2" doxytag="DB::$nbQueries"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> DB::$nbQueries
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
INTERNAL: The number of executed queries.     </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li>db.class.php</ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 29 23:09:34 2005 for db.class.php by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.3 </small></address>
</body>
</html>
Return current item: PHP DB Script