[eluser]Judgestar[/eluser]
Got most of my app working now thanks to the tip Cronix provided. I am running into another problem and hoping I could get some insight as to what I am doing wrong.
Each question for my app posts and insert the value of that question into the database (12 total), I setup a function to sum all of those scores into another row but it is not inserting the sum'ed data. here is my model code for the sum function
Code:
public function count_hygiene_factor($name)
{
//query to sum up the scores
$sql = "SELECT SUM(Factor2Score + Factor5Score + Factor6Score + Factor8Score + Factor9Score + Factor12Score)
from FactorSurveyScore
where Name = ?";
$this->db->query($sql, $name);
}
and I have another function to update that score
Code:
public function update_hygiene_factor($HygieneCount, $name)
{
//query to updte hygiene factor score
$query = "UPDATE FactorSurveyScore Set HygieneFactorScore = (?) WHERE Name = (?)";
$this->db->query($query, array($HygieneCount, $name));
if ($query->num_rows() > 0)
{
return $query->result();
}
else
{
return FALSE;
}
This is what I have in my controller (probably where most of my trouble is coming from)
Code:
public function survey_results()
{
$name = $this->session->userdata('name');
$HygieneCount = $this->User_Model->count_hygiene_factor($name);
$this->load->view('factors_survey/survey_results', $HygieneCount);
}
and my view shows this in an html/php page
Code:
<p>Your Hygiene Factor Score is: <?php echo $HygieneCount; ?><p>
when I run a test run all it shows is nothing/blank area where a sum'ed number should be. Hoping someone could help me out or point me in the right direction to fix this, and yes I am using the user guide to try to fix this but still not seeing where I am going wrong. Thanks for the help in advance