mirror of
https://github.com/itflow-org/itflow
synced 2026-08-15 03:55:14 +00:00
Query Optimization: Select only needed columns instead of SELECT * on looped queries
This commit is contained in:
@@ -30,7 +30,7 @@ ob_start();
|
||||
<select class="form-control select2" name="client_id">
|
||||
<option value="0">- No Client -</option>
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL " . clientScopeSql('clients.client_id') . " ORDER BY client_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL " . clientScopeSql('clients.client_id') . " ORDER BY client_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$client_id_select = intval($row['client_id']);
|
||||
$client_name = escapeHtml($row['client_name']);
|
||||
@@ -61,7 +61,7 @@ ob_start();
|
||||
<select class="form-control select2" name="project_template_id">
|
||||
<option value="">- Template -</option>
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM project_templates WHERE project_template_archived_at IS NULL ORDER BY project_template_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT project_template_id, project_template_name FROM project_templates WHERE project_template_archived_at IS NULL ORDER BY project_template_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$project_template_id = intval($row['project_template_id']);
|
||||
$project_template_name = escapeHtml($row['project_template_name']);
|
||||
|
||||
Reference in New Issue
Block a user