Optimalkiller Posted March 10, 2007 Posted March 10, 2007 Hello everyone, got a problem with a mod for Oscommerce the problem that I'm haveing is that for each row it's repeating the same manufactorer, whichis not correct see the code snippet. <?PHP for ($i=0, $n=sizeof($sales_products ['products_id']); $i<$n; $i++) { // BEGIN associate Manufacturer To Product $v_query = tep_db_query("select manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . $sales_products ['products_id'] . "'"); $v = tep_db_fetch_array($v_query); // Select appropriate Manufacturers Name $mfg_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . $v['manufacturers_id'] . "'"); $mfg = tep_db_fetch_array($mfg_query); } ?> can anyone spot where I have gone wrong on this code snippet. I would be gratefull for any help thanks Optimal
♥bruyndoncx Posted March 10, 2007 Posted March 10, 2007 The first line, the logic around $sales_products. I'm guessing this should be an array, and then further down in teh query it should refer to the $i th element of the array So to be sure, if this doesn't make sense to you, you'll need to post more code specifically where the $sales_products is created KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
Optimalkiller Posted March 10, 2007 Author Posted March 10, 2007 this is the output that I get. 1245 MICROSOFT STREETS AND TRIPS 2007 DVD PC Applications 1 1248 Top Ten Music Collection PC Applications 1 As you can see it keep repeating as application the Bottom one should be Music.
♥bruyndoncx Posted March 10, 2007 Posted March 10, 2007 please post the lines preceding this section whrere you created the $sales_products variable. Without seeing that, can't tell what is should be exactly KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
♥bruyndoncx Posted March 11, 2007 Posted March 11, 2007 KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
♥bruyndoncx Posted March 11, 2007 Posted March 11, 2007 KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
satish Posted March 11, 2007 Posted March 11, 2007 $mfg_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . $v['manufacturers_id'] . "'"); $mfg = tep_db_fetch_array($mfg_query); this line has where manufacturers_id = '" . $v['manufacturers_id'] . "'") which appears to be coming from else where and within the loop it is same. Satish Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does.
♥bruyndoncx Posted March 11, 2007 Posted March 11, 2007 you are right, look a little bit further on how arrays work, that will give you the background and better understanding. there are plenty examples in oscommerce. very llittle code in oscommerce is truely unique, a lot of times you will see a variation on a certain code design. KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
Recommended Posts
Archived
This topic is now archived and is closed to further replies.