Just started to learn php question may not sound quite correct for the more experienced.
I need to fetch rows by date from a database table and output the row data into a particular div container on the page.
id | name | last_name | Date (date format 2019-01-20, standard no change)
Here such a line in a DB.
I need all the lines up to the date (today) to be in div class = "box", if today's date is entered in the string, then the line goes to the markup div class = "box2".
view in mark is such.
<div class="box"> <div>Строка с сегодняшней датой</div> <div>Строка с сегодняшней датой</div> </div> <div class="box2"> <div>Строка не достигшая сегодняшней даты</div> <div>Строка не достигшая сегодняшней даты</div> <div>Строка не достигшая сегодняшней даты</div> </div> function get_table(){ global $link; $sql = "SELECT * FROM `all_name` ORDER BY `priority`,`date`"; $result = mysqli_query($link, $sql); $server = mysqli_fetch_all($result, MYSQLI_ASSOC); return $name_list; } With this method, I pull data from the database, it builds on the priority and date of the string, in one.
`<?php foreach($$name_list as $list_part): <span class="icon"><?=$list_part['name']?></span> <span class="icon"><?=$list_part['last_name']?></span> <span class="icon"><?=$list_part['date']?></span> <?php endforeach;?>` I use this method to insert a document into a div in html. I tried to write the function directly and then output it in one line.
. I do not know how to write a function that will check the list for a date and, based on the date, output it where I need it. Experience in php week, especially do not be angry.