a1amattyj Posted May 14, 2008 Share Posted May 14, 2008 Hello again, My issue: This php file updates a table (multi_db) where it sets 'posts' for each database > which have their own row.. e.g NAME POSTS ID MEMBERS database 1... 1. ... 5 database2 1... 2. ... 5 php code: ?> Now Updating Databases . . . <br /><br /><br /> <?php require('../mf_operations/config_inc.php'); $get_dbs = mysql_query("SELECT * FROM multi_db"); while($row = mysql_fetch_array($get_dbs)){ $dbidd = $row['id']; $mf_forums2 = mysql_query("SELECT sum(posts) FROM multi_forums WHERE id = '$dbidd'") or die(mysql_error()); $row = mysql_fetch_array($mf_forums2); $total = $row["sum(posts)"]; echo 'Database ID: '; echo $dbidd; echo '<br />'; echo 'Total Posts '.$total.''; echo '<br />'; echo '<br />'; } ?> I havn't put the update in yet, im just getting it to echo correct, echo = Now Updating Databases . . . Database ID: 1 Total Posts 1 Database ID: 2 Total Posts 1 Database 1 should be 2, not 1: multi_forums has two rows, of each has 1 post. ta Link to comment https://forums.phpfreaks.com/topic/105578-sum-issue/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.