drakonan Posted May 19, 2003 Posted May 19, 2003 osC coding question: Why does this: $product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id, products_sort_order, from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . $HTTP_GET_VARS['pID'] . "'"); have all those "p." before the tables? I'm trying to add products_sort_orde, but don't know if I need the "p." as well. - - - - Sometimes, ignorance is bliss.
burt Posted May 19, 2003 Posted May 19, 2003 $product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id, products_sort_order, from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . $HTTP_GET_VARS['pID'] . "'"); The MySQL table "products" AKA "TABLE_PRODUCTS" is assigned the letter p, thus: " . TABLE_PRODUCTS . " p, so if you want to call from that table prefix the column name with p. Likewise for "TABLE_PRODUCTS_DESCRIPTION" which is assigned pd. Make sense now ? It's quicker to write p.products_id, than: TABLE_PRODUCTS . ".products_id" etc. Time saver.
drakonan Posted May 19, 2003 Author Posted May 19, 2003 OH, OK. I didn't understand the syntax. I've gotta break down and just read that $50 book I bought. :) Thanks That means I need the P., or do it the long way (which I wondered why "TABLE_PRODUCTS" was "missing.") - - - - Sometimes, ignorance is bliss.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.