I have in a database a table where the logins of each user are registered, and another where I store the modifications that the same user makes in the system.
If the user does not make any changes to the system, nothing will be saved in the table of modifications.
I need to print a list in html where every <li></li>
is a login and only if in the session changes were made to embed a <ul><ul>
where all the corresponding modifications to that session will be.
For example:
<ul>
<li>27-02-2017</li>
<li>28-02-2017
<ul>
<li>Creo usuario nuevo</li>
<li>Cambio departamento a usuario</li>
</ul>
</li>
<li>01-09-2017
<ul>
<li>Elimino usuario</li>
</ul>
</li>
<li>02-02-2018</li>
and in php what I have is something like that
<?php
$query = "SELECT a.field1, a.field2, b.field3, b.field4 from tabla_a a left join tabla_b b on a.field1 = b.field4";
$query = mysqli_query($connect,$query);
echo "<ul>"
while($inf = mysqli_fetch_array()){
echo "<li>{$inf["field2"]}</li>"
}
echo "</ul>";
?>
What I do not know is how to make if the number of matches with left join is equal to or greater than 1 insert the <ul></ul>
, it occurred to me to make a query within the first query but the response would be too slow.
Any suggestions? Thanks in advance.