[eluser]Tim Brownlaw[/eluser]
Well a few questions
Is image the name of a field ( column ) in your table called projects?
Code:
function count_uploads()
{
$query = $this->db->query("SELECT COUNT(image) FROM projects");
return $query->num_rows();
}
So is
Code:
SELECT COUNT(image) FROM projects
a valid statement?
Performing a COUNT operation will only ever result in num_rows being 1, Row with a result of count.
You can do something like
Code:
function count_uploads()
{
return $this->db->count_all('projects');
}
OR the ole fashioned way ( not tested this so it's... not tested
)
Code:
function count_uploads()
{
$query = $this->db->query("SELECT COUNT(image) as count FROM projects");
if($query->num_rows() >0 )
{
$row = $query->row();
return $row->count; // return the count
}
return 0; // if we get there We don't have anything.
}
I dont know what your primary key is... if it''s something like 'id' or 'project_id' - use that instead of 'image'.
Read the User Guide on Active records... and experiment!