Alex Piotto
08-20-2002, 09:45 PM
Hi... I am really stuck here...
This code I wrote, works well until $clean_data (infact, if I view $clean_data in a table it is perfect):
...
for($i=0;$i< $number;$i++) {
$campo1 = $result["campo1"][$i];
$campo2 = $result["campo2"][$i];
$campo3 = $result["campo3"][$i];
$campo4 = $result["campo4"][$i];
$campo5 = $result["campo5"][$i];
$dirty_data = ($campo1." ".$campo2." ".$campo3." ".$campo4." ".$campo5);
$clean_data = ereg_replace("([;:,.?!])"," ",$dirty_data);
$words=explode(" ",$clean_data);
while(list(,$value)=each($words)){
if(strlen(trim($value))>3) $clean_words[]=$value;
}
$keywords = implode(" ",$clean_words);
echo "<tr><td align='center'>$keywords</td></tr>";
}
echo "</table></body></html>";
The script finally filter all the words that are <=3 characters long and leave alone the numbers....
but, inside the printed table (with $keywords) I will find:
in the first row, the first post (filtered)
in the second row the first AND the second post (filtered)
in the third row the first AND the second AND the third post (filtered)... etc etc....
Why? How? I don't need it! Why it multiply?
I am getting crazy....
please, help me out :confused:
Alex
This code I wrote, works well until $clean_data (infact, if I view $clean_data in a table it is perfect):
...
for($i=0;$i< $number;$i++) {
$campo1 = $result["campo1"][$i];
$campo2 = $result["campo2"][$i];
$campo3 = $result["campo3"][$i];
$campo4 = $result["campo4"][$i];
$campo5 = $result["campo5"][$i];
$dirty_data = ($campo1." ".$campo2." ".$campo3." ".$campo4." ".$campo5);
$clean_data = ereg_replace("([;:,.?!])"," ",$dirty_data);
$words=explode(" ",$clean_data);
while(list(,$value)=each($words)){
if(strlen(trim($value))>3) $clean_words[]=$value;
}
$keywords = implode(" ",$clean_words);
echo "<tr><td align='center'>$keywords</td></tr>";
}
echo "</table></body></html>";
The script finally filter all the words that are <=3 characters long and leave alone the numbers....
but, inside the printed table (with $keywords) I will find:
in the first row, the first post (filtered)
in the second row the first AND the second post (filtered)
in the third row the first AND the second AND the third post (filtered)... etc etc....
Why? How? I don't need it! Why it multiply?
I am getting crazy....
please, help me out :confused:
Alex