ivalea Posted October 2, 2006 Share Posted October 2, 2006 Hi all - I'm working with oscommerce and am trying to modify my checkout_success page to basically display a form if the customer purchased a certain model number.right now here is my select statement:[code]$products_array = array(); $products_query = tep_db_query("select products_id, products_name, products_model from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$orders['orders_id'] . "' order by products_name"); while ($products = tep_db_fetch_array($products_query)) { $products_array[] = array('id' => $products['products_id'], 'text' => $products['products_name'], 'model' => $products['products_model']); } }[/code]And this is what I have to display the form:[code]if ($products_array['model'] == 'm1'){ include(form.php); }else{ echo ''; }[/code]The problem is that even when the correct model is purchased that part of the page is still blank - not even so much as an error code. Any thoughts on how I can get this working?Thanks! :) Link to comment https://forums.phpfreaks.com/topic/22766-if-statement-help/ Share on other sites More sharing options...
keithschm Posted October 2, 2006 Share Posted October 2, 2006 wherein checkout_success.php are you putting the code? Link to comment https://forums.phpfreaks.com/topic/22766-if-statement-help/#findComment-102475 Share on other sites More sharing options...
ivalea Posted October 2, 2006 Author Share Posted October 2, 2006 on line 97 - right after this code which displays the checkbox to receive notifications on items just purchased:[code]$products_displayed = array(); for ($i=0, $n=sizeof($products_array); $i<$n; $i++) { if (!in_array($products_array[$i]['id'], $products_displayed)) { echo tep_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '<br>'; $products_displayed[] = $products_array[$i]['id']; } } echo '</p>'; } else { echo TEXT_SEE_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER; }[/code] Link to comment https://forums.phpfreaks.com/topic/22766-if-statement-help/#findComment-102488 Share on other sites More sharing options...
keithschm Posted October 2, 2006 Share Posted October 2, 2006 try this[code]$products_array = array();$products_query = tep_db_query("select products_id, products_name, products_model from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$orders['orders_id'] . "' order by products_name"); while ($products = tep_db_fetch_array($products_query)) { $model = $products['products_model']; }if ($model == 'm1'){ include(form.php); }else{ echo ''; }[/code]edit had typo Link to comment https://forums.phpfreaks.com/topic/22766-if-statement-help/#findComment-102536 Share on other sites More sharing options...
ivalea Posted October 2, 2006 Author Share Posted October 2, 2006 Thanks much Keith - that seemed to do the trick! - Irene :) Link to comment https://forums.phpfreaks.com/topic/22766-if-statement-help/#findComment-102586 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.