Hi
I have a simple script displaying a whole table that works fine!
$result = mysql_query(\"SELECT * FROM tbl\") or die (\"msg\");
while ($row = mysql_fetch_array($result)) { ...
echoing out all information in a tbl
}
For one of the columns I now want to add the sum at the end of the table.
I added the query before entering the while loop:
$result = mysql_query(\"SELECT * FROM tbl\") or die (\"msg\");
$sql = mysql_query(\"SELECT SUM (Col) AS total FROM tbl \") or die (\"msg2\");
$total = mysql_fetch_row($sql);
while ($row = mysql_fetch_array($result)) { ...
echoing all information in a tbl
}
echo $total;
It doesn\'t work. It doesn\'t connect to the database for the second query. I use mysql_pconnect earlier in the script - shouldn\'t that connection stay permanent?
Any ideas?