CraXyOW3 Posted April 9, 2007 Share Posted April 9, 2007 So, i've downloaded the Contrib "Newsdesk" which is exactly what i was looking for, altho there is one annoying problem i can not figure out on my own and now i turn to the illuminated people here at the forums in hope that you can help me ! The error is the following: 1054 - Unknown column 'p.newsdesk_id' in 'on clause' select count(p.newsdesk_id) as total from newsdesk_description pd, newsdesk p left join manufacturers m on p.newsdesk_id = m.manufacturers_id, newsdesk_to_categories p2c left join specials s on p.newsdesk_id = s.products_id where p.newsdesk_status = '1' and p.newsdesk_id = p2c.newsdesk_id and pd.newsdesk_id = p2c.newsdesk_id and pd.language_id = '4' and p2c.categories_id = '11' [TEP STOP] I am completely blank regarding this problem and really in need of a fix :P I did read about that the sql statement was prior to version 5 faulty, but my knowledge only goes so far... Source: http://www.oscommerce.com/community/contributions,934 Thanks! Quote Link to comment Share on other sites More sharing options...
CraXyOW3 Posted April 12, 2007 Author Share Posted April 12, 2007 *bump* Not a single soul that can help me ? Quote Link to comment Share on other sites More sharing options...
CraXyOW3 Posted April 12, 2007 Author Share Posted April 12, 2007 Uhm, well, i have fiddled around with the on clause somewhat now and done some RTFM stuff and so far i have only removed 2 chars and now it works, i dont know if this was a valid solution, but it works now! From $listing_sql = "select " . $select_column_list . " p.newsdesk_id, p.newsdesk_status, p.newsdesk_date_added, pd.newsdesk_article_name, pd.newsdesk_article_shorttext, pd.newsdesk_article_description, pd.newsdesk_article_url, pd.newsdesk_article_url_name, p.newsdesk_image, p.newsdesk_image_two, p.newsdesk_image_three, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, NULL) as final_price from " . TABLE_NEWSDESK_DESCRIPTION . " pd, " . TABLE_NEWSDESK . " p left join " . TABLE_MANUFACTURERS . " m on p.newsdesk_id = m.manufacturers_id, " . TABLE_NEWSDESK_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.newsdesk_id = s.products_id where p.newsdesk_status = '1' and p.newsdesk_id = p2c.newsdesk_id and pd.newsdesk_id = p2c.newsdesk_id and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . $current_category_id . "'"; To $listing_sql = "select " . $select_column_list . " p.newsdesk_id, p.newsdesk_status, p.newsdesk_date_added, pd.newsdesk_article_name, pd.newsdesk_article_shorttext, pd.newsdesk_article_description, pd.newsdesk_article_url, pd.newsdesk_article_url_name, p.newsdesk_image, p.newsdesk_image_two, p.newsdesk_image_three, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, NULL) as final_price from " . TABLE_NEWSDESK_DESCRIPTION . " pd, " . TABLE_NEWSDESK . " p left join " . TABLE_MANUFACTURERS . " m on p.newsdesk_id = m.manufacturers_id, " . TABLE_NEWSDESK_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on newsdesk_id = s.products_id where p.newsdesk_status = '1' and p.newsdesk_id = p2c.newsdesk_id and pd.newsdesk_id = p2c.newsdesk_id and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . $current_category_id . "'"; Third line from bottom was changed "on p.newsdesk_id" to "on newsdesk_id". Now when i got this working, could someone just tell me if this was a "valid" solution ? Quote Link to comment Share on other sites More sharing options...
alex_rus Posted April 14, 2007 Share Posted April 14, 2007 Uhm, well, i have fiddled around with the on clause somewhat now and done some RTFM stuff and so far i have only removed 2 chars and now it works, i dont know if this was a valid solution, but it works now! From $listing_sql = "select " . $select_column_list . " p.newsdesk_id, p.newsdesk_status, p.newsdesk_date_added, pd.newsdesk_article_name, pd.newsdesk_article_shorttext, pd.newsdesk_article_description, pd.newsdesk_article_url, pd.newsdesk_article_url_name, p.newsdesk_image, p.newsdesk_image_two, p.newsdesk_image_three, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, NULL) as final_price from " . TABLE_NEWSDESK_DESCRIPTION . " pd, " . TABLE_NEWSDESK . " p left join " . TABLE_MANUFACTURERS . " m on p.newsdesk_id = m.manufacturers_id, " . TABLE_NEWSDESK_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.newsdesk_id = s.products_id where p.newsdesk_status = '1' and p.newsdesk_id = p2c.newsdesk_id and pd.newsdesk_id = p2c.newsdesk_id and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . $current_category_id . "'"; To $listing_sql = "select " . $select_column_list . " p.newsdesk_id, p.newsdesk_status, p.newsdesk_date_added, pd.newsdesk_article_name, pd.newsdesk_article_shorttext, pd.newsdesk_article_description, pd.newsdesk_article_url, pd.newsdesk_article_url_name, p.newsdesk_image, p.newsdesk_image_two, p.newsdesk_image_three, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, NULL) as final_price from " . TABLE_NEWSDESK_DESCRIPTION . " pd, " . TABLE_NEWSDESK . " p left join " . TABLE_MANUFACTURERS . " m on p.newsdesk_id = m.manufacturers_id, " . TABLE_NEWSDESK_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on newsdesk_id = s.products_id where p.newsdesk_status = '1' and p.newsdesk_id = p2c.newsdesk_id and pd.newsdesk_id = p2c.newsdesk_id and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . $current_category_id . "'"; Third line from bottom was changed "on p.newsdesk_id" to "on newsdesk_id". Now when i got this working, could someone just tell me if this was a "valid" solution ? better solution can be: change the identified code to the following code: $listing_sql = "select " . $select_column_list . " p.newsdesk_id, p.newsdesk_status, p.newsdesk_date_added, pd.newsdesk_article_name, pd.newsdesk_article_shorttext, pd.newsdesk_article_description, pd.newsdesk_article_url, pd.newsdesk_article_url_name, p.newsdesk_image, p.newsdesk_image_two, p.newsdesk_image_three, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, NULL) as final_price from (" . TABLE_NEWSDESK_DESCRIPTION . " pd, " . TABLE_NEWSDESK . " p left join " . TABLE_MANUFACTURERS . " m on p.newsdesk_id = m.manufacturers_id, " . TABLE_NEWSDESK_TO_CATEGORIES . " p2c ) left join " . TABLE_SPECIALS . " s on p.newsdesk_id = s.products_id where p.newsdesk_status = '1' and p.newsdesk_id = p2c.newsdesk_id and pd.newsdesk_id = p2c.newsdesk_id and pd.language_id = '" . $languages_id . "' and p2c.categories_id = '" . $current_category_id . "'"; Alex Quote Link to comment Share on other sites More sharing options...
CraXyOW3 Posted April 14, 2007 Author Share Posted April 14, 2007 TY Alot Alex! This fixed my problems with Newsdesk, been lurking and even started to learn some basic php and sql in the process, but after coding in another language ive been quite stuck with it and had hard time cooping with this. Thnx again, this fix should be mentioned on the contribs section too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.