Razvan2k3
-
Posts
2 -
Joined
-
Last visited
Posts posted by Razvan2k3
-
-
Hello,
I am glad I joined this forums, seems a good way to find out all about web-programming. I`m starting to check most of the topics.
I am posting because I need an advice / solution to some project I am working on.
Short info: It is in fact on a sub-page, where I wish to display some info from the MySQL database via PHP.
Sub-Problem #1.
I managed to display all other columns / rows but the last one is an actual "Operation = Subtraction" from the last 2.
Since it is in an array, I do not know how to do that - to correlate one with another. Managed to make other info's on the site but when they were not in an array.
$Profit = $Pret_sol - $Pret_achizitie
(translation: profit = price asked to client - acquisition price)
Sub-Problem #2.
Also, as each ID (its an order number ID - can have multiple parts and prices - as shown in the picture - how can I only display totals value for an order ID (total $pret_sol / $pret_achizitie), so that it does not display each consecutive one?
That would be all, please let me know your solutions or advice, I give you:
1. Website screen actual working.
2. Part of the code with the functions.
Thank you very much!
<div class="row"> <div class="col-sm-12"> <h4 class="page-title">Financiar rapoarte <font color="d3283c"> ></font> Toate facturile</h4> <div class="card-box table-responsive"> <table id="datatable-buttons" class="table table-hover m-0 table-bordered"> <thead> <tr> <th><font color="337ab7">Numar intrare</font></th> <th><font color="337ab7">Marca</font></th> <th><font color="337ab7">Model</font></th> <th><font color="337ab7">Data livrare</font></th> <th><font color="337ab7">Venit / Facturat</font></th> <th><font color="337ab7">Cheltuieli</font></th> <th><font color="5cb85c">Profit</font></th> </tr> </thead> <tbody> <?php $result = mysql_query("SELECT receptie.id, receptie.marca_tel, receptie.model, receptie.data_primire, articole_service.pret_sol, articole_service.pret_achizitie FROM receptie inner join articole_service on receptie.id = articole_service.id_receptie"); while ($row = mysql_fetch_array($result)) { ?> <tr> <td><?php echo $row['id']; ?></td> <td><?php echo $row['marca_tel']; ?></td> <td><?php echo $row['model']; ?></td> <td><?php echo $row['data_primire']; ?></td> <td><?php echo $row['pret_sol']; ?></td> <td><?php echo $row['pret_achizitie']; ?></td> <td>Profit=Pret_sol-Pret_achizitie</td> </tr> <?php } ?> </tbody> </table> </div> </div><!-- end col --> </div> <!-- end row -->
Help for a PHP select script for my website
in PHP Coding Help
Posted · Edited by Barand
image removed - unsuitable content
Thank you very much - it works perfectly. And for my second problem - to display the totals for each id.
As said: on an ID I have multiple articles prices / and profit for each article. I want to count total for an ID: