*** Sorry if this is a duplicate for some on another list**
Hi Guys,
I need help with this code I am about to paste. It works on a testing
server running PHP 4.2.2 but not 4.3.2
Here is the error:
Warning: array_merge_recursive(): recursion detected in
/services2/webpages/r/i/rinkrake.com/public/test.php on line 26
Here is the code:
<?php
echo "Generating results, this could take a minute....<br>";
// Allow the script enough time to finish (lots of data, lots of loops)
set_time_limit(999);
// db connection
$link = mysql_connect("xxx", "xxx", "xxx");
mysql_select_db("xxx");
// We need these queries to do our job
$we_ordered_1 = mysql_query("select OrderTable.cart_id,
CartTable.cart_id, CartTable.product_index from OrderTable, CartTable
where CartTable.product_index = 1 and OrderTable.cart_id =
CartTable.cart_id");
$we_ordered_14 = mysql_query("select OrderTable.cart_id,
CartTable.cart_id, CartTable.product_index from OrderTable, CartTable
where CartTable.product_index = 14 and OrderTable.cart_id =
CartTable.cart_id");
$customers = mysql_query("select cart_id, first, last, email from
OrderTable");
// Compare cart_id's between customers who ordered product #1 and #14.
If the customer
// ordered #1 and not #14, put their cart_id in the $good_customers
array and move on
// to the next.
while ($row1 = mysql_fetch_row($we_ordered_1))
{
while ($row2 = mysql_fetch_row($we_ordered_14))
{
if ($row1[0] != $row2[0])
{
$temp[cust_id] = $row1[1];
$good_customers =
array_merge_recursive($good_customers,$temp);
}
}
mysql_data_seek($we_ordered_14,0);
}
// Free up some memory, reset things back to square one (just to be on
the safe side)
// and get rid of any duplicate items in our newly created array.
mysql_free_result($we_ordered_1);
mysql_free_result($we_ordered_14);
unset ($temp);
reset ($good_customers);
$good_customers = array_unique($good_customers[cust_id]);
// Fetch a customer, step through the $good_customers array and
// compare the cart_id stored in $good_customers, if they match,
// kick out a 'record' with the necessary data.
while ($row3 = mysql_fetch_row($customers))
{
foreach ($good_customers as $value)
{
if ($row3[0] == $value)
{
echo $row3[0]." | ".$row3[1]." |
".$row3[2]." | ".$row3[3]."<br>\n";
}
}
}
mysql_close($link);
echo "<script language=JavaScript>alert(\"Done!\");</script>";
?>
CAN anyone help me resolve the problem? I know it has to do with a bug
being fixed for array_merge_recursive but I don't know how to resolve
the problem and get the results I need :-(
Please help?
Thanks so much!!!
Aaron