Jump to content

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in


wanttoshop

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.