Welcome Guest, Not a member yet? Register   Sign In
Looping through a DB for all information
#6

[eluser]CroNiX[/eluser]
Code:
$data = $this->db
  ->select('type, COUNT(id) AS total')
  ->group_by('type')
  ->get('toys')
  ->result_array();

foreach($data as $d)
{
  echo 'Type: ' . $d['type'] . ', Total: ' . $d['total'] . '<br>';
}


Messages In This Thread
Looping through a DB for all information - by El Forum - 04-30-2012, 10:34 AM
Looping through a DB for all information - by El Forum - 04-30-2012, 11:00 AM
Looping through a DB for all information - by El Forum - 04-30-2012, 12:03 PM
Looping through a DB for all information - by El Forum - 04-30-2012, 12:23 PM
Looping through a DB for all information - by El Forum - 04-30-2012, 07:58 PM
Looping through a DB for all information - by El Forum - 04-30-2012, 08:06 PM
Looping through a DB for all information - by El Forum - 04-30-2012, 08:32 PM
Looping through a DB for all information - by El Forum - 04-30-2012, 11:17 PM
Looping through a DB for all information - by El Forum - 05-01-2012, 08:16 AM
Looping through a DB for all information - by El Forum - 05-01-2012, 09:34 AM
Looping through a DB for all information - by El Forum - 05-01-2012, 09:42 AM
Looping through a DB for all information - by El Forum - 05-01-2012, 10:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB