I have this code right here :
$bestffffs = $db->query("SELECT * FROM chapter WHERE ch_trans = '".$wordss."' ORDER BY ch_trans DESC ");
while($ftffffs = $db->fetch_array($bestffffs))
{
$bestffffrs[] = $ftffffs;
}
$result = array_unique($bestffffrs);
the MYSQL query have at least 45 results! but when I tried using array_unique()
my results reduced down to one! am I using the code at the wrong place? I tried placing it everywhere but nothing worked!
I cannot use Group by on my MYSQL query because I want to remove duplicates from more than one field in my table. Group by will only remove duplicates for the field that I choose. If there is other soultion using MYSQL please include it here.
One thing you can try is DISTINCT. You can use DISTINCT with multiple fields:
SELECT DISTINCT(one and two and three...and n) FROM `your_table`...
Give that a shot. If that doesn't work, try:
SELECT distinctrow field_one, distinctrow field_two, distinctrow field_three FROM `your_table`;
Specify SORT_REGULAR
as the second argument.
Otherwise, it compares them as strings. Any array is converted to the literal string "Array"
, which of course means they are all "equal".