Answer the question
In order to leave comments, you need to log in
Why is the loop displaying the same information 3 times?
Please tell me why this code fetches data from the database 3 times
// Вывод информации о товарах
$html = '<table border="1" width="80%" align="center" class="tableSelect">';
foreach (DataBase::getDb()->getRow('SELECT * FROM ' . Config::DB_TABLE_GOODS) as $row) {
$html .= '<tr>';
$html .= '<td width="10%">' . $row['barcode_good'] . '</td>
<td width="50%">' . $row['name_good'] . '</td>
<td width="5%">' . $row['price_good'] . ' руб.</td>
<td width="15%">' . $row['id_group'] . '</td>';
$html .= '</tr>';
unset($row);
}
$html .= '</table><br><br>';
echo $html;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question