<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1021497" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1021497</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/subtotals-and-totals#comment-1132481</link>
    <description> &lt;p&gt;You&#039;re creating an object within a function?  You should probably make the variable static, or pass the object as an argument to the function (or just destry the object before returning from the function).&lt;/p&gt;
 </description>
     <pubDate>Wed, 04 Jun 2003 02:29:33 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1132481 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/subtotals-and-totals#comment-1132471</link>
    <description> &lt;p&gt;The advantage is usually that there is less code to write which, of course, reduces debugging time, etc. Speed is better usually as long as it is not a complex query.&lt;/p&gt;
 </description>
     <pubDate>Tue, 03 Jun 2003 17:15:59 +0000</pubDate>
 <dc:creator>mairving</dc:creator>
 <guid isPermaLink="false">comment 1132471 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/subtotals-and-totals#comment-1132469</link>
    <description> &lt;p&gt;What&#039;s the advantage to using MySQL (or any other db) over using scripting?&lt;/p&gt;
 </description>
     <pubDate>Tue, 03 Jun 2003 16:54:41 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1132469 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/subtotals-and-totals#comment-1132468</link>
    <description> &lt;p&gt;I usually prefer to do in SQL, depending on the query times. I wrote it as a function in a class like so:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;count&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$fieldname&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) {&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$db_sql &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= new &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;db_sql&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$count &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$fieldname&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;.\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;_count\&quot;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$q&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = \&quot;SELECT sum(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$fieldname&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;) as &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$count&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; \&quot;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$q&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; .= \&quot;FROM tablename \&quot;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$q&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; .= \&quot;WHERE &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$fieldname&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; &amp;gt;= &#039;1&#039; \&quot;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$db_sql&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$q&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$db_sql&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;next_record&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;();&lt;br /&gt;return &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$count&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;;&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;So that I just have to call it via:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$class&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;count&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;fieldname\&quot;);&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Tue, 03 Jun 2003 16:43:31 +0000</pubDate>
 <dc:creator>mairving</dc:creator>
 <guid isPermaLink="false">comment 1132468 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/subtotals-and-totals#comment-1132467</link>
    <description> &lt;p&gt;I like to do as much work in mySQL as possible.&lt;/p&gt;
&lt;p&gt;SELECT sum(countfield) AS fieldname_subtotal FROM tablename GROUP BY typefield&lt;/p&gt;
&lt;p&gt;This would give subtotals for various `typefield`, then suming those (in PHP) would give a grand total.&lt;/p&gt;
 </description>
     <pubDate>Tue, 03 Jun 2003 16:27:46 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1132467 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/subtotals-and-totals#comment-1132465</link>
    <description> &lt;p&gt;Interesting. I haven&#039;t done anything that requires tabulating with a database, so I&#039;m not much help opinion-wise (aren&#039;t you relieved!) but I&#039;m curious about whether it&#039;d be better to have the database do the work or the application (perl/php/asp)?&lt;/p&gt;
 </description>
     <pubDate>Tue, 03 Jun 2003 16:18:52 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1132465 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
