mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
replace all instances of mysqli_fetch_array with mysqli_fetch_assoc for better performance and memory usage
This commit is contained in:
@@ -22,7 +22,7 @@ if (!empty($client_id)) {
|
||||
|
||||
// Stop recurring invoices
|
||||
$sql_recurring_invoices = mysqli_query($mysqli, "SELECT * FROM recurring_invoices WHERE recurring_invoice_client_id = $client_id AND recurring_invoice_status = 1");
|
||||
while ($row = mysqli_fetch_array($sql_recurring_invoices)) {
|
||||
while ($row = mysqli_fetch_assoc($sql_recurring_invoices)) {
|
||||
$recurring_invoice_id = intval($row['recurring_invoice_id']);
|
||||
mysqli_query($mysqli,"UPDATE recurring_invoices SET recurring_invoice_status = 0 WHERE recurring_invoice_id = $recurring_invoice_id AND recurring_invoice_client_id = $client_id");
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_status = 0, history_description = 'Recurring Invoice inactive as client archived', history_recurring_invoice_id = $recurring_invoice_id");
|
||||
@@ -41,4 +41,4 @@ if (!empty($client_id)) {
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once '../update_output.php';
|
||||
require_once '../update_output.php';
|
||||
|
||||
@@ -36,7 +36,7 @@ if ($sql && mysqli_num_rows($sql) > 0) {
|
||||
$return_arr['count'] = mysqli_num_rows($sql);
|
||||
|
||||
$row = array();
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$row['credential_username'] = apiDecryptCredentialEntry($row['credential_username'], $api_key_decrypt_hash, $api_key_decrypt_password);
|
||||
$row['credential_password'] = apiDecryptCredentialEntry($row['credential_password'], $api_key_decrypt_hash, $api_key_decrypt_password);
|
||||
$return_arr['data'][] = $row;
|
||||
|
||||
@@ -11,7 +11,7 @@ if ($sql && mysqli_num_rows($sql) > 0) {
|
||||
$return_arr['count'] = mysqli_num_rows($sql);
|
||||
|
||||
$row = array();
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$return_arr['data'][] = $row;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ require_once '../require_post_method.php';
|
||||
require_once "../../../includes/load_global_settings.php";
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT company_name, company_phone FROM companies WHERE company_id = 1");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$company_name = $row['company_name'];
|
||||
$company_phone = formatPhoneNumber($row['company_phone']);
|
||||
|
||||
@@ -28,7 +28,7 @@ if (!empty($subject)) {
|
||||
// If no contact is selected automatically choose the primary contact for the client (if client set)
|
||||
if ($contact == 0 && $client_id != 0) {
|
||||
$sql = mysqli_query($mysqli,"SELECT contact_id FROM contacts WHERE contact_client_id = $client_id AND contact_primary = 1");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$contact = intval($row['contact_id']);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ if (isset($api_key)) {
|
||||
// SUCCESS
|
||||
|
||||
// Set client ID, company ID & key name
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$api_key_name = htmlentities($row['api_key_name']);
|
||||
$api_key_decrypt_hash = $row['api_key_decrypt_hash']; // No sanitization
|
||||
$client_id = intval($row['api_key_client_id']);
|
||||
|
||||
Reference in New Issue
Block a user