There's been a push recently to use exactly-equal (===) comparisons to 'tighten' various sections of the code. Be careful when applying those comparisons to information retrieved via database queries.
I'd thought that fields defined as integer/float values would be returned as their respective value types, but all field values other than NULL are being returned as strings.
Running zc156c with the demo products, you can view those results via a teeny test script:
Code:
<?php
require 'includes/application_top.php';
$check = $db->Execute(
"SELECT * FROM " . TABLE_PRODUCTS . " WHERE products_id = 221 LIMIT 1"
);
echo nl2br(var_export($check->fields, true)) . '<br><br>';
$test = array(1, 2, 3);
echo nl2br(var_export($test, true));
require DIR_WS_INCLUDES . 'application_bottom.php';
... which produces the following output, showing that (for instance) the products_id (defined as an integer value) is being returned as a string value:
Code:
array (
'products_id' => '221',
'products_type' => '1',
'products_quantity' => '1000',
'products_model' => 'DOWNLOAD1',
'products_image' => '1_small.jpg',
'products_price' => '39.0000',
'products_virtual' => '0',
'products_date_added' => '2019-05-14 15:22:16',
'products_last_modified' => NULL,
'products_date_available' => NULL,
'products_weight' => '0',
'products_status' => '0',
'products_tax_class_id' => '1',
'manufacturers_id' => '0',
'products_ordered' => '0',
'products_quantity_order_min' => '1',
'products_quantity_order_units' => '1',
'products_priced_by_attribute' => '0',
'product_is_free' => '0',
'product_is_call' => '0',
'products_quantity_mixed' => '1',
'product_is_always_free_shipping' => '0',
'products_qty_box_status' => '1',
'products_quantity_order_max' => '0',
'products_sort_order' => '0',
'products_discount_type' => '0',
'products_discount_type_from' => '0',
'products_price_sorter' => '39.0000',
'master_categories_id' => '60',
'products_mixed_discount_quantity' => '1',
'metatags_title_status' => '0',
'metatags_products_name_status' => '0',
'metatags_model_status' => '0',
'metatags_price_status' => '0',
'metatags_title_tagline_status' => '0',
'posm_manages_price' => '0',
)
array (
0 => 1,
1 => 2,
2 => 3,
)
Bookmarks