muddy004 Posted January 23, 2008 Share Posted January 23, 2008 Dear Freaks, This is an odd question. I've inherited a very old php application. I attempted to upgrade it. The application is used to add certain columns of data. On the original server, three columns add just fine (output to a report). On the upgraded server (newer mysql and php), the report displays zero for the three columns. This is the code for adding the three columns: # locations $sql_locs = "SELECT sum(C1NearHome)+sum(C2NearHome)+sum(C3NearHome), sum(C1NearWork)+sum(C2NearWork)+sum(C3NearWork), sum(C1NearSchool)+sum(C2NearSchool)+sum(C3NearSchool) FROM request WHERE YMDHMS >= $bgnDate AND YMDHMS <= $endDate"; $res_locs = mysql_query($sql_locs); $nrow_locs = mysql_num_rows($res_locs); if ($nrow_locs > 0) { $row_locs = mysql_fetch_row($res_locs); $stats[$stindx . "nearHome"] = $row_locs[0]; $stats[$stindx . "nearWork"] = $row_locs[1]; $stats[$stindx . "nearSchool"] = $row_locs[2]; } This line: sum(C1NearSchool)+sum(C2NearSchool)+sum(C3NearSchool) isn't adding correctly. The report on the new server shows zero, but on the old server, for example, the number is 4. If I remove two of the sums and make it: sum(C1NearSchool) the report displays the total for that column. When I add the two other sums back to the equation, I get zero again. Any ideas what's wrong here? Any help is greatly appreciated. Quote Link to comment Share on other sites More sharing options...
fenway Posted January 24, 2008 Share Posted January 24, 2008 I don't see how that's possible... missing quotes? Quote Link to comment Share on other sites More sharing options...
muddy004 Posted February 8, 2008 Author Share Posted February 8, 2008 What do you mean "missing quotes?" Do you mean that there's something wrong in the code? If so, that's what I'm trying to figure out. thanks Quote Link to comment Share on other sites More sharing options...
fenway Posted February 8, 2008 Share Posted February 8, 2008 Around your date fields. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.