mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 19:04:52 +00:00
replace all instances of mysqli_fetch_array with mysqli_fetch_assoc for better performance and memory usage
This commit is contained in:
@@ -37,7 +37,7 @@ if (isset($_GET['quote_id'])) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$quote_id = intval($row['quote_id']);
|
||||
$quote_prefix = nullable_htmlentities($row['quote_prefix']);
|
||||
$quote_number = intval($row['quote_number']);
|
||||
@@ -77,7 +77,7 @@ if (isset($_GET['quote_id'])) {
|
||||
$page_title = "{$row['quote_prefix']}{$row['quote_number']}";
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
|
||||
$company_id = intval($row['company_id']);
|
||||
$company_name = nullable_htmlentities($row['company_name']);
|
||||
@@ -113,7 +113,7 @@ if (isset($_GET['quote_id'])) {
|
||||
$products_sql = mysqli_query($mysqli, "SELECT product_name AS label, product_description AS description, product_price AS price, product_tax_id AS tax FROM products WHERE product_archived_at IS NULL");
|
||||
|
||||
if (mysqli_num_rows($products_sql) > 0) {
|
||||
while ($row = mysqli_fetch_array($products_sql)) {
|
||||
while ($row = mysqli_fetch_assoc($products_sql)) {
|
||||
$products[] = $row;
|
||||
}
|
||||
$json_products = json_encode($products);
|
||||
@@ -309,7 +309,7 @@ if (isset($_GET['quote_id'])) {
|
||||
$total_tax = 0.00;
|
||||
$sub_total = 0.00;
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_items)) {
|
||||
while ($row = mysqli_fetch_assoc($sql_items)) {
|
||||
$item_id = intval($row['item_id']);
|
||||
$item_name = nullable_htmlentities($row['item_name']);
|
||||
$item_description = nullable_htmlentities($row['item_description']);
|
||||
@@ -371,7 +371,7 @@ if (isset($_GET['quote_id'])) {
|
||||
<input type="hidden" name="item_order" value="<?php
|
||||
//find largest order number and add 1
|
||||
$sql = mysqli_query($mysqli, "SELECT MAX(item_order) AS item_order FROM invoice_items WHERE item_quote_id = $quote_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$item_order = intval($row['item_order']) + 1;
|
||||
echo $item_order;
|
||||
?>">
|
||||
@@ -394,7 +394,7 @@ if (isset($_GET['quote_id'])) {
|
||||
<?php
|
||||
|
||||
$taxes_sql = mysqli_query($mysqli, "SELECT tax_id, tax_name, tax_percent FROM taxes WHERE tax_archived_at IS NULL ORDER BY tax_name ASC");
|
||||
while ($row = mysqli_fetch_array($taxes_sql)) {
|
||||
while ($row = mysqli_fetch_assoc($taxes_sql)) {
|
||||
$tax_id = intval($row['tax_id']);
|
||||
$tax_name = nullable_htmlentities($row['tax_name']);
|
||||
$tax_percent = floatval($row['tax_percent']);
|
||||
@@ -501,7 +501,7 @@ if (isset($_GET['quote_id'])) {
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($quote_file = mysqli_fetch_array($sql_quote_files)) {
|
||||
while ($quote_file = mysqli_fetch_assoc($sql_quote_files)) {
|
||||
$name = nullable_htmlentities($quote_file['file_name']);
|
||||
$ref_name = nullable_htmlentities($quote_file['file_reference_name']);
|
||||
$created = nullable_htmlentities($quote_file['file_created_at']);
|
||||
@@ -549,7 +549,7 @@ if (isset($_GET['quote_id'])) {
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_history)) {
|
||||
while ($row = mysqli_fetch_assoc($sql_history)) {
|
||||
$history_created_at = nullable_htmlentities($row['history_created_at']);
|
||||
$history_status = nullable_htmlentities($row['history_status']);
|
||||
$history_description = nullable_htmlentities($row['history_description']);
|
||||
|
||||
Reference in New Issue
Block a user