Hello guys i am trying to combine two sql queries and every time the loop retun an empty array this is my code
first query
$ONP = ($conn->query("SELECT * FROM EcronRapp where code = '$opt' and date >= CAST('$dd' AS DATE) and date <= CAST('$df' AS DATE)")->fetchAllAssociative());
second query
$analyse = ($conn->query("SELECT * from DoublonB where date >= CAST('$dd' AS DATE) and dat <= CAST('$df' AS DATE)")->fetchAllAssociative());
and this is the loop
foreach ($ONP as $key => $item) {
$counter = 0;
$An=null;
foreach ($analyse as $doublon)
if ($item["Code"] === $doublon["Ref"]) {
$An = $doublon["code"];
$An = $doublon["code"] . 'times in the file ref ' . $doublon["Ref"];
$counter++;
}
$ONP[$key]["Ref"] = $An;
}
this is my front page
{% for t in response3 %} {{t['date'] | format('d-m-y')}} {{t['mt']}} {{t['Code Autorisation']}} {{t['Ref']}} {% endfor %}