In the following piece of code where I populate a table from a mysql table I don't know how to reference the sum column
$sql = "select
sum(vote1c+vote2) , vote_name
from votes
where voteid = 1
group by vote_name
order by 1 desc , vote_name"; };
$result = mysql_query($sql) or die("Couldn't execute query.");
printf("<TABLE WIDTH=\"100%%\" BGCOLOR =\"#9999FF\" NOSAVE>\n");
printf("<TR>
<TD><B>No of votes</B></TD>
<TD><B>vote name</B></TD>
</TR>\n");
printf("<TR>
<TD><B>* </B></TD>
<TD><B>* </B></TD>
</TR>\n");
while (($row=mysql_fetch_object($result))){
printf("<TR>
<TD>%s</TD>
<TD>%s</TD>
</TR>\n",
$row->????,
$row->vote_name) ;
}
printf("</TABLE>\n");
How do I reference the sum column within the table column. Its got me stumped !




Bookmarks