MarioPro
12-29-2005, 12:48 PM
I've been looping arround this resultset trying to find a way to filter this and nothing. Anyone available to give me a hand here? Thanks in advance.
Here's what's up:
These are the results I have on $foundStyles but the ones in red shouldn't go to the query. Is there a way to filter these results?
KEY: 0 & VALUE: 3488
KEY: 1 & VALUE: 3485
KEY: 2 & VALUE: 2860
KEY: 3 & VALUE: 3482
KEY: 4 & VALUE: 3
KEY: 5 & VALUE: 0
KEY: 6 & VALUE: 1
KEY: 7 & VALUE: 2
KEY: 8 & VALUE: 3
KEY: 9 & VALUE: 4
In fact, I think that my problem comes a little from above where I have the following code to obtain ONLY the values in the array that have more than one occurence.
// The array $foundStyles would seem something like this
$foundstyles=array(0=>3488, 1=>3485, 2=>3488, 3=>2562, 4=>3485, 5=>1785, 6=>2232);
// I just want the 3488 and 3485 since these are the only ones that are repeated
// and what I need is to make the array $foundstyles to become like this
// array(0=>3488, 1=>3485) and for that I made the code below
// GET ONLY THE KEYS DUPLICATES FOR NEXT QUERY
if($rows>0){ // From mysql_query
$foundStyles=array_count_values($foundStyles);
}
foreach($foundStyles as $key=>$value){
if($value>=$total_styles){
$foundStyles[]=$key;
}
}
Humm....
Here's what's up:
These are the results I have on $foundStyles but the ones in red shouldn't go to the query. Is there a way to filter these results?
KEY: 0 & VALUE: 3488
KEY: 1 & VALUE: 3485
KEY: 2 & VALUE: 2860
KEY: 3 & VALUE: 3482
KEY: 4 & VALUE: 3
KEY: 5 & VALUE: 0
KEY: 6 & VALUE: 1
KEY: 7 & VALUE: 2
KEY: 8 & VALUE: 3
KEY: 9 & VALUE: 4
In fact, I think that my problem comes a little from above where I have the following code to obtain ONLY the values in the array that have more than one occurence.
// The array $foundStyles would seem something like this
$foundstyles=array(0=>3488, 1=>3485, 2=>3488, 3=>2562, 4=>3485, 5=>1785, 6=>2232);
// I just want the 3488 and 3485 since these are the only ones that are repeated
// and what I need is to make the array $foundstyles to become like this
// array(0=>3488, 1=>3485) and for that I made the code below
// GET ONLY THE KEYS DUPLICATES FOR NEXT QUERY
if($rows>0){ // From mysql_query
$foundStyles=array_count_values($foundStyles);
}
foreach($foundStyles as $key=>$value){
if($value>=$total_styles){
$foundStyles[]=$key;
}
}
Humm....