• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Call to a member function row() on a non-object

#5
[eluser]Aken[/eluser]
You've got a lot of unnecessary logic going on. You're using one query to retrieve all of the IDs, and then you're looping through them and doing individual queries to get each row. Pretty redundant, considering you can retrieve all of that data just doing one normal query.

Code:
$query = $this->db
->query("SELECT fb_id, total_page_like, talking_about_count, were_here_count FROM fb_page_profile")
->result();

// result() returns an array of objects, each object is a row in the DB.

foreach ($query as $row)
{
$score = $row->total_page_like + $row->talking_about_count + $row->were_here_count;
}


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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.