Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,407 members, 7,954,606 topics. Date: Saturday, 21 September 2024 at 12:44 AM |
Nairaland Forum / Science/Technology / Programming / Please Help!!! Sum 2 Or More Same ID Within A Date Range (1138 Views)
Does Javascript Have A Built In Range() Method? / How Can I Send Bulk SMS To MTN Numbers With My Sender Id / Please Someone Should Help Vba To Compute The Product And Sum Of H.C.F And L.C.M (2) (3) (4)
Please Help!!! Sum 2 Or More Same ID Within A Date Range by nicolas247(m): 5:25am On May 02, 2018 |
Please what is wrong with my code <?php include('connect.php'); if (isset($_GET["d1"])) { $d1 = $_GET["d1"]; } else { $d1=0; }; if (isset($_GET["d2"])) { $d2 = $_GET["d2"]; } else { $d2=0; }; $result = $db->prepare("SELECT *, SUM(loan_amt), SUM(loan_int), SUM(saving), SUM(total_ded) FROM transaction WHERE trans_date BETWEEN :a AND :b GROUP BY memberId " $result->bindParam(':a', $d1); $result->bindParam(':b', $d2); $result->execute(); for($i=0; $row = $result->fetch(); $i++){ ?> <tr class="record"> <td><?php echo $row['memberId']; ?></td> <td><?php echo $row['trans_date']; ?></td> <td><?php echo $row['fname']; ?></td> <td><?php echo $row['SUM(loan_amt)']; ?></td> <td><?php echo $row['SUM(loan_int)']; ?></td> <td><?php echo $row['SUM(saving)']; ?></td> <td><?php echo $row['SUM(total_ded)']; ?></td> </tr> <?php } ?> What i want to archive is to be able to sum same memberId within a date range please what am i doing wrong thanks for the help |
Re: Please Help!!! Sum 2 Or More Same ID Within A Date Range by nicolas247(m): 1:11pm On May 06, 2018 |
People just they pass nii help a brother o thanks |
Re: Please Help!!! Sum 2 Or More Same ID Within A Date Range by Jenifa123: 1:46pm On May 06, 2018 |
nicolas247: Are u selecting from a table or wah? |
Re: Please Help!!! Sum 2 Or More Same ID Within A Date Range by nicolas247(m): 3:22pm On May 06, 2018 |
yes am selecting from a table call TRANSACTION |
Re: Please Help!!! Sum 2 Or More Same ID Within A Date Range by nicolas247(m): 11:09pm On May 06, 2018 |
Jenifa123: yes i am |
Re: Please Help!!! Sum 2 Or More Same ID Within A Date Range by Jenifa123: 3:31pm On May 07, 2018 |
nicolas247:U should look at ur query again? |
Re: Please Help!!! Sum 2 Or More Same ID Within A Date Range by kudaisi(m): 12:26am On May 09, 2018 |
You're not stating a problem. Did you try executing the SQL directly in your database engine ? if so, did it work ? If yes, then we can safely assume the problem is from the PHP end of your code. Otherwise, take a second look at your SQL query. Is your PHP code not producing the desired result ? Or maybe you're not getting any output. Points like this helps narrow down the problem. Please try and be more specific about what you want. |
(1) (Reply)
Facebook Could Face NGN 59.495 Trillion Fine Over Latest Hack Under GDPR / Payment Involved: Full Stack Developer Or Software Developer / Want To Develop Some Mobile Application.is There Any Provide Company Which Can
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 16 |