Welcome Guest, Not a member yet? Register   Sign In
Call to a member function row() on a non-object
#3

[eluser]stephencoverdale[/eluser]
Your right. I tried removing result() and using row() in the model but it still did not work. My goal is that I want to scan each facebook id and then with that facebook id it will then go and collect selective data from another table, add them together and print a different score for each of the facebook id's. My issue however comes to the fact that trying to run the nested foreach causes issues as when it echos the final score it only gives me one score that added up the data from every facebook id but there should be multiple scores. This is why I tried using the row() function to limit to just one row for each score to hope tofix this issue. Am I looking at this wrong?

Here is function I am trying -
Code:
function scorecalc(){
  $this->load->model("get_db");
  $data['fbid'] = $this->get_db->getFBID();
  foreach($data['fbid'] as $row){
   $fbid = $row->fb_id;
  $data['fbdata'] = $this->get_db->getFB($fbid);
  foreach($data['fbdata'] as $row){
   $likes = $row->total_page_like;
   $talkingabout = $row->talking_about_count;
   $werehere = $row->were_here_count;
   $score = $likes+$talkingabout+$werehere;
   echo $score;
   }
  
  }

Model functions -
Code:
function getFBID(){
  $query = $this->db->query("SELECT `fb_id` FROM `fb_page_profile`");

  return $query->result();

}


function getFB($fb){
  $query = $this->db->get("SELECT total_page_like, talking_about_count, were_here_count FROM `fb_page_profile` WHERE fb_id =  '$fb'");

  return $query->result();

}

Thanks,
Steve


Messages In This Thread
Call to a member function row() on a non-object - by El Forum - 12-08-2012, 01:53 AM
Call to a member function row() on a non-object - by El Forum - 12-08-2012, 02:06 AM
Call to a member function row() on a non-object - by El Forum - 12-08-2012, 11:54 AM
Call to a member function row() on a non-object - by El Forum - 12-08-2012, 12:39 PM
Call to a member function row() on a non-object - by El Forum - 12-08-2012, 08:27 PM
Call to a member function row() on a non-object - by El Forum - 12-08-2012, 10:44 PM
Call to a member function row() on a non-object - by El Forum - 12-11-2012, 10:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB