wanttoshop Posted January 2, 2009 Share Posted January 2, 2009 I have oscommerce store, intalled a contribution. Page displays with inputs on forms working but I get this error half way down page. Warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\htdocs\mystorename\myadminfoldername\orderlist.php on line 349 349 is in blue <!--// BEGIN customers drop down selection list //--> <?php $customers_query = tep_db_query("select customers_id, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " order by customers_firstname ASC"); while ($customers = tep_db_fetch_array($customers_query)) { $customers_firstname = $customers['customers_firstname']; $customers_lastname = $customers['customers_lastname']; $customers_array[] = array('id' => $customers['customers_id'], 'text' => $customers_firstname . ' ' . $customers_lastname); } ?> or <?php echo tep_draw_form('customers', FILENAME_ORDERLIST, '', 'get') . HEADING_TITLE_CUSTOMER_SELECT . ' ' . tep_draw_pull_down_menu('cID', array_merge(array(array('id' => '', 'text' => TEXT_SELECT_CLIENT)), $customers_array), (isset($_GET['customers_id']) ? $_GET['cID'] : ''), 'onChange="this.form.submit();"'); ?></form> <?php if (isset($_GET['cID']) && tep_not_null($_GET['cID'])) { ?> <?php echo '<a href="' . tep_href_link(FILENAME_ORDERLIST) . '">' . tep_image_button('button_reset.gif', IMAGE_RESET, 'align="absmiddle"') . '</a>'; ?> <?php } ?> <!--// END customers drop down selection list //--> Thanks for any help Link to comment https://forums.phpfreaks.com/topic/139244-warning-array_merge-functionarray-merge-argument-2-is-not-an-array-in/ Share on other sites More sharing options...
Mark Baker Posted January 4, 2009 Share Posted January 4, 2009 If your database query returns no customers, then $customers_array is undefined and will therefore return this error when you try to use it in the array merge. Try doing $customers_array = array(); immediately prior to your while loop. Alternatively, check your query result to be sure that it does actually return data Link to comment https://forums.phpfreaks.com/topic/139244-warning-array_merge-functionarray-merge-argument-2-is-not-an-array-in/#findComment-729487 Share on other sites More sharing options...
wanttoshop Posted January 5, 2009 Author Share Posted January 5, 2009 Thank you for the reply Mark. While waiting I was trying to figure things out. I had been messing with phpmyadmin trying to learn about it and had deleted the John Doe customer that is in the default install. when I read over and over (Argument #2 is not an array in) and i seen in the code there was cid. I thought perhaps there needed to be a customer in database. I login and made myself one and that solved the problem. Thanks again for taking the time to help. Link to comment https://forums.phpfreaks.com/topic/139244-warning-array_merge-functionarray-merge-argument-2-is-not-an-array-in/#findComment-729609 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.