<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1027827" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1027827</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/undefined-index-error#comment-1164786</link>
    <description> &lt;p&gt;try count(amt) as totamt&lt;/p&gt;
&lt;p&gt;looking at your orginal code&lt;br /&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;Quote:  $db_query_sum = db_query(&quot;SELECT &#039;totamt&#039; = sum(amt) from payment WHERE prgname=&#039;&quot;.$db_values[&quot;prgname&quot;].&quot;&#039;&quot;);&lt;br /&gt;
$db_values_amt = mysql_fetch_array($db_query_sum);&lt;br /&gt;
echo $db_values[&quot;prgname&quot;].&quot; - &quot;.$db_values_amt[&quot;totamt&quot;].&quot; - &quot;. $db_query_sum.&quot;&quot;; &lt;/blockquote&gt;&lt;/p&gt;
&lt;p&gt; you are only calling a value, not an array, so the $db_values_amt line isn&#039;t needed.&lt;/p&gt;
&lt;p&gt;try something like:&lt;br /&gt;
	$db_query = &quot;select count(amt) as totamt from payment WHERE prgname=&#039;&quot;.$db_values[&quot;prgname&quot;].&quot;&#039;&quot;;&lt;br /&gt;
	$db_result = mysql_query($db_query);&lt;br /&gt;
	$totamt = mysql_result($db_result,0,&quot;totamt&quot;);&lt;/p&gt;
&lt;p&gt;I didn&#039;t test the above but should work.&lt;br /&gt;
depending what amt&#039;s value is, you could possibly use max() if you&#039;re just trying to find the largest number. count will add them up, max will give largest number, sum will add them up (as in dollar value), think there are a couple more as well&lt;/p&gt;
 </description>
     <pubDate>Tue, 25 Jan 2005 10:58:15 +0000</pubDate>
 <dc:creator>Busy</dc:creator>
 <guid isPermaLink="false">comment 1164786 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/undefined-index-error#comment-1164724</link>
    <description> &lt;p&gt;Just tried what Busy said. Didnt work  &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/sad.png&quot; title=&quot;Sad&quot; alt=&quot;Sad&quot; class=&quot;smiley-content&quot; /&gt; &lt;/p&gt;
&lt;p&gt;Keith&lt;/p&gt;
 </description>
     <pubDate>Mon, 24 Jan 2005 22:01:14 +0000</pubDate>
 <dc:creator>keith2045</dc:creator>
 <guid isPermaLink="false">comment 1164724 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/undefined-index-error#comment-1164707</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;CptAwesome wrote:&lt;/strong&gt; I am guessing that it found multiple columns, and the sum() adds them together. Which is why amt wouldn&#039;t work, because it&#039;s going to find multiple rows, and you didn&#039;t loop your mysql_fetch_array&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;should have been &quot;I am guessing that it found multiple rows&quot;&lt;/p&gt;
&lt;p&gt;the code I showed would pull the amt column into an array, and then array_sum would add them together.&lt;/p&gt;
&lt;p&gt;and I didn&#039;t try what Busy said, but &quot;X as Y&quot; might work, I am pretty new at MySQL mySelf &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Mon, 24 Jan 2005 19:19:39 +0000</pubDate>
 <dc:creator>CptAwesome</dc:creator>
 <guid isPermaLink="false">comment 1164707 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/undefined-index-error#comment-1164706</link>
    <description> &lt;p&gt;Well the column name is &#039;amt&#039;, and their is only one, so it shouldnt have gotten multiple columns. What i wanted to do add all of the info in the &#039;amt&#039; column. So the sum() function takes all of the rows and adds the amt column. Well i didnt know how to reference this value, so i tried to name it totamnt,  but i couldnt reference totamt(dont know why). So in order to reference the sum i had to use &#039;sum(amt)&#039;.&lt;/p&gt;
&lt;p&gt;Keith&lt;/p&gt;
 </description>
     <pubDate>Mon, 24 Jan 2005 19:01:38 +0000</pubDate>
 <dc:creator>keith2045</dc:creator>
 <guid isPermaLink="false">comment 1164706 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/undefined-index-error#comment-1164691</link>
    <description> &lt;p&gt;Keith, since you&#039;re not sure why, I think I can clarify.&lt;/p&gt;
&lt;p&gt;SELECT selects a column from the row which is found with the where clause.&lt;/p&gt;
&lt;p&gt;I am guessing that it found multiple columns, and the sum() adds them together. Which is why amt wouldn&#039;t work, because it&#039;s going to find multiple rows, and you didn&#039;t loop your mysql_fetch_array&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;$db_query_sum = db_query(&amp;quot;SELECT amt FROM payment WHERE prgname=&amp;#039;&amp;quot;.$db_values[&amp;quot;prgname&amp;quot;].&amp;quot;&amp;#039;&amp;quot;); &lt;br /&gt;while($db_loop_value = mysql_fetch_array($db_query_sum))&lt;br /&gt;	{&lt;br /&gt;	$db_values_amt[] = $db_loop_value[amt];&lt;br /&gt;	}&lt;br /&gt;$totam = array_sum($db_values_amt);&lt;br /&gt;echo $db_values[&amp;quot;prgname&amp;quot;].&amp;quot; - &amp;quot;.$db_values_amt[&amp;quot;totamt&amp;quot;].&amp;quot; - &amp;quot;. $db_query_sum.&amp;quot;&amp;lt;br&amp;gt;&amp;quot;; &lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Mon, 24 Jan 2005 14:52:51 +0000</pubDate>
 <dc:creator>CptAwesome</dc:creator>
 <guid isPermaLink="false">comment 1164691 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/undefined-index-error#comment-1164674</link>
    <description> &lt;p&gt;select sum(amt) as totamt ... ?&lt;/p&gt;
 </description>
     <pubDate>Mon, 24 Jan 2005 10:19:45 +0000</pubDate>
 <dc:creator>Busy</dc:creator>
 <guid isPermaLink="false">comment 1164674 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/undefined-index-error#comment-1164652</link>
    <description> &lt;p&gt;Ok ummm...&lt;/p&gt;
&lt;p&gt;I couldnt get it to work by referencing the &#039;totamt&#039; or &#039;amt&#039;, not sure why? Here is how i got it working.&lt;/p&gt;
&lt;p&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;$db_query_sum &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;db_query&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;SELECT sum(amt) from payment WHERE prgname=&#039;\&quot;.&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$db_values&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;\&quot;prgname\&quot;].\&quot;&#039;\&quot;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$db_values_amt&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = mysql_fetch_array(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$db_query_sum&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;echo &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$db_values&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;\&quot;prgname\&quot;].\&quot; - \&quot;.&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$db_values_amt&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;\&quot;sum(amt)\&quot;].\&quot;&amp;lt;br&amp;gt;\&quot;; &lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt; &lt;/p&gt;
&lt;p&gt;Keith&lt;/p&gt;
 </description>
     <pubDate>Sun, 23 Jan 2005 22:06:30 +0000</pubDate>
 <dc:creator>keith2045</dc:creator>
 <guid isPermaLink="false">comment 1164652 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/undefined-index-error#comment-1164606</link>
    <description> &lt;p&gt;Perhaps post up the solution so that others may learn from this?&lt;/p&gt;
 </description>
     <pubDate>Sun, 23 Jan 2005 10:19:51 +0000</pubDate>
 <dc:creator>Renegade</dc:creator>
 <guid isPermaLink="false">comment 1164606 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/undefined-index-error#comment-1164588</link>
    <description> &lt;p&gt;Just got it to work.&lt;/p&gt;
&lt;p&gt;Thanks anyway&lt;/p&gt;
&lt;p&gt;Keith&lt;/p&gt;
 </description>
     <pubDate>Sun, 23 Jan 2005 01:33:26 +0000</pubDate>
 <dc:creator>keith2045</dc:creator>
 <guid isPermaLink="false">comment 1164588 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
