This is a discussion on Please explain tep_db_query() format within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; Can someone please explain the tep_db_query() function format? In this code snippet: $category_query = tep_db_query("select cd.categories_name, cd.categories_heading_title, cd.categories_description, c.categories_image from ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Can someone please explain the tep_db_query() function format? In this code snippet: $category_query = tep_db_query("select cd.categories_name, cd.categories_heading_title, cd.categories_description, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $current_category_id . "' and cd.categories_id = '" . $current_category_id . "' and cd.language_id = '" . $languages_id . "'"); why are cd. and c. used instead of the full table names? Also, what about "cd where c.categories_id". The cd. and the c. are supposed to be table names, but I can't find where they are defined no matter how much I search. Please point me to a tutorial or ref man if you know of one also. |
| Sponsored Links | ||
| ||
|
#2
| |||
| |||
| cd, and c are not table names, they r alias, keeps the query looking short and neat, for more info look here: http://dev.mysql.com/doc/mysql/en/legal-names.html table names are defined in catalog/includes/database_tables.php, the function "tep_db_query" itself can be found in catalog/includes/functions/database.php |
|
#3
| |||
| |||
| Thank you. And yes, they are alias' but where do you define them in oscommerce. I don't see cd, and c and i've been searching. |
|
#4
| |||
| |||
| [quote="dhobson"]Thank you. And yes, they are aliasIs this the code snippet that creates the definition? TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd |
|
#5
| ||||
| ||||
| Yeah it is. You dont' have to define cd and c some where else except the query you pasted in your thread. |
| Sponsored Links | ||
| ||
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Please Explain ????? | learoypc | osCMax v2 Features Discussion | 2 | 09-26-2006 10:21 PM |
| How do you print the results of tep_db_query() | dhobson | osCommerce 2.2 Modification Help | 3 | 01-27-2005 08:43 AM |
| Explain "quantity" number with added text? | petrea | osCommerce 2.2 Modification Help | 2 | 06-13-2004 02:51 PM |
| can someone explain how to adapt regular osc boxes to.. | Anonymous | osCMax v1.7 Discussion | 2 | 03-10-2004 02:55 PM |
| PLEASE explain how I can use the BTS (basic template system) | lucius | osCMax v1.7 Discussion | 1 | 10-23-2003 07:51 PM |