
Originally Posted by
oboeonetwothree
What's the difference between defined tables and actual table names in terms of examples and why it matters?
The difference:
WRONG
Code:
"SELECT options_id FROM products_attributes WHERE products_id = $products_id..."
CORRECT
Code:
"SELECT options_id FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = $products_id..."
When the tables names are defined they include the assigned table prefix.
Code:
define('TABLE_PRODUCTS_ATTRIBUTES', DB_PREFIX . 'products_attributes');
If you assigned a table prefix to your Zen Cart tables, then not using the defined table name would cause an "table not found" error.
Bookmarks