I have the following data and would like to display it in different containers in html.
Name Price Difference Signal CA.PA 15.85 3.5609257364073 MACD AZN.ST 896 3.4881049471963 MACD AMGN 258.57 1.6391533819031 SMA 50/200
The containers are winner_1. As of right now the first winner_1 display the last Name from the above table.
How can I get it to say CA.PA in the first winner_1, and AZN.ST in the second winner_1, and AMGN in the last winner_1.
<div class="overview"> <h1>Winners</h1> <div class="winner"> <?php foreach ($res_winners_weekly as $r){ $name = $r["Name"]; $Price = $r['Price']; $percent_diff = $r['Difference']; $signal = $r['Signal']; } ?> <div class="winner_1"> <a href="#"><?php echo $name; ?></a> </div> <div class="winner_1"> <a href="#"><?php echo $name +1; ?></a> </div> <div class="winner_1"> </div> </div> </div>
The page can be seen here: https://signal-invest.com/markets-today/
Advertisement
Answer
One option is generated div tags using php:
<div class="overview"> <h1>Winners</h1> <div class="winner"> <?php foreach ($res_winners_weekly as $r) { $name = $r["Name"]; $Price = $r['Price']; $percent_diff = $r['Difference']; $signal = $r['Signal']; echo "<div class='winner_1'>"; echo "<a href='#'>{$name}</a>"; echo "</div>"; } ?> </div> </div>