Good afternoon! I'm having a problem with how to think of something effective.
I have two tables: budgets and budgetlines. In the table budget_lines are some items, eg:
All of these records have the boolean id associated with the budget table, basically its function is to group all the rows of the other table. So good, everything works fine!
Here is the question: I need to print on the screen by "Blocks", that is: take all the lines of the table budget and group with the budget table values and all these values will be printed in div1 (example) And the other rows associated with another record in the budget table will be printed in div2 (example), and so on
The problem is that I can not think of a logic to do this, I tried a few things, but the end result has always been to print each line followed by the other. Here is the code I'm currently using:
$sql_select = "SELECT * FROM orcamentos_linha INNER JOIN orcamentos ON (orcamentos.id = orcamentos_linha.id_orcamento AND DATE(orcamentos.data_limite) > CURDATE() ) WHERE cad = ?";
$stmt = $database->prepare($sql_select);
$stmt->execute([$user->getCad]);