I am revisting this script after a few months on and off due to work commitments.
I need to pull in the data from the products table i.e. gtin and also exclude products that are inactive.
I am a bit stumped on the query whether to left join, inner join etc.
Any help offered to get me to the next stage would be appreciated.
Code: Select all
/* Our products_description array is now built, start checking data. */
$missing_description = [];
foreach ($db->fetch_all("SELECT products_id, language_id, products_name, products_description FROM products_description") as $product) {
if (empty($product['products_description'])) {
Guarantor::guarantee_subarray($missing_description, $product['products_id']);
$missing_description[$product['products_id']][$product['language_id']] = $product['products_name'] ?? 'Name missing';
}
}
?>
<div class="w-75 mt-4 mx-auto"><h3>Missing Products Description Report</h3></div>
<div class="w-75 mt-4 mx-auto"><h6>The table below is the result of checking the products_description table for missing product descriptions.</h6></div>
<table class="table w-75 table-fit mt-4 mx-auto">
<thead class="thead-light">
<tr>
<th><?php echo 'id'; ?></th>
<th><?php echo 'Name'; ?></th>
<th></th>
</tr>
</thead>
<?php
foreach ($missing_description as $id => $data) {
foreach ($data as $l => $name) {
?>
<tr>
<td><?= $id ?></td>
<td><?= $name ?></td>
</tr>
<?php
}
}
?>
</tr>
</table>