<?php
// SAME FOR USING DB TO GET GET THE VALUES AND DISPLAY DEPEND ON THE WORD COUNT
// DAMU
function wordcount($str) {
return count(explode(" ",$str)); }
function word_count($str,$word){
$str = str_replace(". "," ",$str);
$words = explode(" ",$str);
$count=0;
foreach($words as $key=>$value){
if($value == $word){
$count++;
}
}
return $count;
}
mysql_connect("localhost","root","");
mysql_select_db("damu_test");
$sql = "select * from content";
$result = mysql_query($sql);
$text = "";
$contents = "";
while ($row = mysql_fetch_array($result))
{
$contents .= strip_tags($row['content']);
$contents .=",";
$count .= word_count($contents , "damu");
$count .=",";
}
// DAMu
echo"";
$value_array = explode(",",$contents);
$key_array = explode(",",$count);
$array_content = array_combine($key_array, $value_array);
$final_list = krsort($array_content);
//damu
//print_r($array_content);
foreach($array_content as $rasultval)
{
echo"
".$rasultval;
}
?>