replace all instances of mysqli_fetch_array with mysqli_fetch_assoc for better performance and memory usage

This commit is contained in:
johnnyq
2026-01-14 17:30:23 -05:00
parent cb8b99d6ae
commit 0a30300bde
361 changed files with 1880 additions and 1904 deletions

View File

@@ -34,7 +34,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
$ticket_contact_snippet"
);
$ticket_row = mysqli_fetch_array($ticket_sql);
$ticket_row = mysqli_fetch_assoc($ticket_sql);
if ($ticket_row) {
@@ -128,7 +128,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
<?php echo $ticket_details ?>
<?php
while ($ticket_attachment = mysqli_fetch_array($sql_ticket_attachments)) {
while ($ticket_attachment = mysqli_fetch_assoc($sql_ticket_attachments)) {
$name = nullable_htmlentities($ticket_attachment['ticket_attachment_name']);
$ref_name = nullable_htmlentities($ticket_attachment['ticket_attachment_reference_name']);
echo "<hr><i class='fas fa-fw fa-paperclip text-secondary mr-1'></i>$name | <a href='../uploads/tickets/$ticket_id/$ref_name' download='$name'><i class='fas fa-fw fa-download mr-1'></i>Download</a> | <a target='_blank' href='../uploads/tickets/$ticket_id/$ref_name'><i class='fas fa-fw fa-external-link-alt mr-1'></i>View</a>";
@@ -147,7 +147,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
<ul>
<?php
while ($approvals = mysqli_fetch_array($sql_task_approvals)) {
while ($approvals = mysqli_fetch_assoc($sql_task_approvals)) {
$task_id = intval($approvals['task_id']);
$approval_id = intval($approvals['approval_id']);
$task_name = nullable_htmlentities($approvals['task_name']);
@@ -256,7 +256,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM ticket_replies LEFT JOIN users ON ticket_reply_by = user_id LEFT JOIN contacts ON ticket_reply_by = contact_id WHERE ticket_reply_ticket_id = $ticket_id AND ticket_reply_archived_at IS NULL AND ticket_reply_type != 'Internal' ORDER BY ticket_reply_id DESC");
while ($row = mysqli_fetch_array($sql)) {
while ($row = mysqli_fetch_assoc($sql)) {
$ticket_reply_id = intval($row['ticket_reply_id']);
$ticket_reply = $purifier->purify($row['ticket_reply']);
$ticket_reply_created_at = nullable_htmlentities($row['ticket_reply_created_at']);
@@ -318,7 +318,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
<?php echo $ticket_reply; ?>
<?php
while ($ticket_attachment = mysqli_fetch_array($sql_ticket_reply_attachments)) {
while ($ticket_attachment = mysqli_fetch_assoc($sql_ticket_reply_attachments)) {
$name = nullable_htmlentities($ticket_attachment['ticket_attachment_name']);
$ref_name = nullable_htmlentities($ticket_attachment['ticket_attachment_reference_name']);
echo "<hr><i class='fas fa-fw fa-paperclip text-secondary mr-1'></i>$name | <a href='../uploads/tickets/$ticket_id/$ref_name' download='$name'><i class='fas fa-fw fa-download mr-1'></i>Download</a> | <a target='_blank' href='../uploads/tickets/$ticket_id/$ref_name'><i class='fas fa-fw fa-external-link-alt mr-1'></i>View</a>";
@@ -345,5 +345,3 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
}
require_once "includes/footer.php";