i'm using an array from a session set shopping cart to create a 'customers who bought this also bought' script. so the array $items is sent to this function to store when two or more items are purchased at the same time.
however the original array would not store, this seems to be working for the moment with array_keys, can you forsee any probs with it?
function setRel($items)
{
while($item=array_pop($items))
{
foreach ($items as $each)
{
if ($item == $each){continue;}
$pair=array($item,$each);
sort($pair);
list($i1,$i2)=$pair;
$conn = db_connect();
list($times)=@mysql_fetch_row(@mysql_query("select times from relsel where id1='$i1' and id2='$i2'"));
$times++;
@mysql_query("replace relsel set id1='$i1',id2='$i2',times='$times'");
}
}
}