Hello friends,
First of all i would like to apologize for maybe asking stupid questions, I am new to codeigniter and php/sql in general.
I am using a script called Cicool that i purchest on codecanyon.
so far so good, its really easy to make a crud and edit the style of the view to personalize the look and implement my own layout.
but i would like to make a view charts based on the date from users this to make a nice overview of their own data.
I have tried to do this in de view because i thought that would be easy to use it elsewhere if needed. (like a snippet)
with Cicool you have the option to add a users id to a table and then only show their own data from the database.
this works fine but when i use my own query it sums op data from all the rows, so also the data of other people.
so the query works, but not as supposed to.
In my view:
Code:
<?php
if (!$this->aauth->is_admin()) {
$this->db->where($this->table_name.'.log_user', get_user_data('id'));
$urenlog = $this->db->query ('SELECT SEC_TO_TIME( SUM( TIME_TO_SEC( `log_totaltimeflight` ) ) ) AS totaaluren FROM app_log');
}
foreach ($urenlog->result() as $row)
{
echo $row->totaaluren;
}
?>
I know that i am doing this all wrong and i should use the MVC where it is for.
But i lack to much knowledge to figure out this myself.
Also i am not asking for a copy past solution, I would like to learn and figure things out but for now i am stuck :-(
Sorry if the English doesn't make sense, i don't write that lot of English ;-)
Best regards,