It can be done with few queries as following.
1) get array of all texts posted by THE USER between 1 month and 2 month. Lets say array name is $words. For example,
DEFINE FUNCTION SOMETHING LIKE THIS:
function get_words_array($userid,$startinterval,$endinterval)
{
$records = qa_db_read_all_assoc(qa_db_query_sub(
"SELECT content
FROM ^posts
WHERE userid = # AND (date_created BETWEEN $ AND $)",
$userid, $startinterval, $endinterval
));
return $records;
}
RUN ABOVE DEFINED FUNCTION TO GET ARRAY OF CONTENTS BY SPECIFIC USER AT SPECIFIC INTERVAL:
$words = get_words_array($userid,$startinterval,$endinterval);
2) convert array ($words) to string and merge them by foreach loop. Assign it to new variable $words_all_string
$words_all_string ='';
foreach ( $words AS $key=>$word) {
$words_all_string .= $word.' '.;
}
3) count words by
str_word_count($words_all_string); |