나는 텍스트 문자열을 꺼내서 데이터베이스 쿼리를배열에서 중복 단어를 제거하려면 어떻게해야합니까?
$descriptionsQuery = mysql_query("select prob_text from opencall where logdatex between $OneHourAgo and $TimeNow ORDER by callref DESC") or die(mysql_error());
$descriptions = array();
while ($row = mysql_fetch_assoc($descriptionsQuery)){
$descriptions[] = $row['prob_text'];
}
//put all the strings together with a space between them
$glue = implode (" ",$descriptions);
내가이 "설명은 []"하나의 긴 문자열로 "접착"전에 ..., 내가 '되어 도움을 꿔 중복 된 단어를 제거하고 싶습니다. 일단 그들이 붙어, 나는 각 원본 설명에서 중복 단어가 의존하고있어. 설명하기가 어렵습니다. 여기에 제가 의미하는 바가 있습니다. 2 명의 사용자가 텍스트를 입력합니다 (예 : User1 : "I have an issue with Leeds server. I am in Leeds"
User2 : "Margaret in Leeds has a problem, please call margaret"
). 이걸로 User1은 마침내 접착제로 묶인 문자열에 1 개만 "Leeds"를 갖게하고 User2는 1 마가렛 만 가질 수 있습니다.하지만 두 사용자 모두 "Leeds"를 언급하므로 각 사용자가 한 번씩 두 번 붙인 문자열에 넣고 싶습니다. 이것이 가능한가? 어떤 도움을 주셔서 감사합니다.
http://uk3.php.net/function.array-unique – putvande
왜 SQL 쿼리를 'SELECT DISTICT prob_text FROM opencall'로 변경하지 않습니까? –
mysql_을 삭제하고 mysqli_로 이동하십시오. mysql_가 PHP에 의해 삭제되기까지는 시간 문제입니다. – Mave