A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearHow can I search/summarize my PHP results? - page 1
User InfoPosts
How can I search/summarize my PHP results?#1
I(ve retrieved a series of objects from the Twitter API, and I want to summarize them. I(m most familiar with analyzing results from a SQL query, but given a series of objects like this:

array(9) { 
["results"]=> array(1) {
[0]=> array(9) {
["text"]=> string(14) "4.2 #runlogger"
["to_user_id"]=> NULL
["from_user"]=> string(13) "alexmcpherson"
["id"]=> int(1459499489)
["from_user_id"]=> int(4647988)
["iso_language_code"]=> string(2) "it"
["source"]=> string(59) "<a href="http://twitter.com/">web</a>"
["profile_image_url"]=> string(59) "http://static.twitter.com/images/default_profile_normal.png"
["created_at"]=> string(31) "Sun, 05 Apr 2009 23:10:45 +0000"
} }
["since_id"]=> int(0)
["max_id"]=> int(1461841556)
["refresh_url"]=> string(35) "?since_id=1461841556&q=%23runlogger"
["results_per_page"]=> int(15)
["total"]=> int(1)
["completed_in"]=> float(0.073063)
["page"]=> int(1)
["query"]=> string(12) "%23runlogger"
}


Would it be possible to somehow say "for each object where (from_user=$whoever(, tally up the (text( field, minus the #runlogger"? I can figure out the code once I have the large-scale idea I think, but am not sure how to start in a general way. Would I set each instance of the (text( field to a variable, then add those variables into an array or something?

I(m a quick study, but would love some guidance in this problem.

Thanks!

posted date: 2009-04-09 18:44:00


Re: How can I search/summarize my PHP results?#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-09 18:44:01


Re: How can I search/summarize my PHP results?#3
Assume that you assign this to an array $array1foreach($array1[(results(] as $currentResult) { if($currentResult[(from_user(] == $whoever) { $strippedTexts = explode(" ", $currentResult[(text(]); $strText .= $strippedTexts[0]; }}echo $strText;regards

posted date: 2009-04-09 18:54:00


Re: How can I search/summarize my PHP results?#4
Just perfect. Good code.

posted date: 2009-04-09 19:06:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.