I've given myself a headache on this one ... not that it's difficult to do so...I gave the managers the ability to add items to more than one category by 'copying' an entry to the db with a different value in one field. (Yup, dropped primary key...)
Now if you search for something that matches, you get that item in your result array once for each entry in the db. If an item's in 3 categories, it shows up 3 times in the search results.
I tried $result_array=array_unique($result_array); but that, apparently, only allows one entry in the array, since a single-level call like that matches "Array" for each entry...and not really a big surprise, that. I kludged around with the MySQL "DISTINCT" keyword, and with various permutations of conditionals nested in foreach() and while() statements; I looked at the manual for array_multisort until my head hurts, my wife wants me to do something else for a while, and I think I agree....
If any of you wizards could quietly mutter the correct incantation and perhaps drop a copy here, I'd be much obliged. Shoot, you don't have to be a wizard, just provide a working solootion that doesn't eat all the C-P-U cycles. If not, I'll hit it again tomorrow or Monday. Further information is available upon request...example array follows. Desired outcome is that the array has only one "HS-9300 series" in it...it should be freakin' easy, but I'm giving up for the time being...
array(3) {
[0]=> array(8) {
["sku"]=> string(6) "HS-659"
["manf"]=> string(12) "Horace Small"
["name"]=> string(27) "Deputy Deluxe, Short Sleeve"
["color"]=> string(14) "Dark Navy, Tan"
["size"]=> string(10) "S, M, L, X"
["catid"]=> string(1) "3"
["price"]=> string(5) "39.95"
["description"]=> string(38) "Outstanding garment from Horace Small."
}
[1]=> array(8) {
["sku"]=> string(14) "HS-8300-SERIES"
["manf"]=> string(12) "Horace Small"
["name"]=> string(10) "Honor Corp"
["color"]=> string(22) "Dark Navy, French Blue"
["size"]=> string(20) "32,34,36,38,40,42,44"
["catid"]=> string(1) "1"
["price"]=> string(5) "44.95"
["description"]=> string(56) "100% Poly/Elastique fabric, great fitting pant."
}
[2]=> array(8) {
["sku"]=> string(14) "HS-8300-SERIES"
["manf"]=> string(12) "Horace Small"
["name"]=> string(10) "Honor Corp"
["color"]=> string(22) "Dark Navy, French Blue"
["size"]=> string(20) "32,34,36,38,40,42,44"
["catid"]=> string(1) "3"
["price"]=> string(5) "44.95"
["description"]=> string(56) "100%Poly/Elastique fabric, great fitting pant."
}
}