Ok, I am back, and still lost in array land.
I am now trying to merge 2 arrays so I can do 2 inserts with the key of one array and the value from another.
I have (again) products array:
products [1] = 1258
products [6] = 1201
and then a comment for each (comments array)
comments [1] = 'comment for productId 1258'
comments [6] = 'comment for productId 1201'
But I tried this approach and I get the data inserted twice (and I cant see how to get the data without looping thru the 2 arrays, and not get duplicate inserts).
foreach( $_SESSION['products'] as $productId => $productkey ) {
foreach( $_SESSION['comments'] as $commentsId => $commentskey) {
$sql = "INSERT INTO table (productkey , commentskey) VALUES ($productkey , $commentskey)";
}
}
I hope I can eventually get my brain 'wrapped around' arrays.
Thanks,
d.