Query Optimization: Select only needed columns instead of SELECT * on looped queries

This commit is contained in:
johnnyq
2026-08-06 12:59:43 -04:00
parent 77defcf7d8
commit b8c9d5b4cf
117 changed files with 345 additions and 227 deletions

View File

@@ -37,7 +37,7 @@ ob_start();
<option value="">- Contact -</option>
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
$sql = mysqli_query($mysqli, "SELECT contact_id, contact_name FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
while ($row = mysqli_fetch_assoc($sql)) {
$contact_id = intval($row['contact_id']);
$contact_name = escapeHtml($row['contact_name']);