Welcome Guest, Not a member yet? Register   Sign In
Form radio buttons will not validate, need help.
#4

[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: &lt;?php echo $HygieneCount; ?&gt;<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 Smile


Messages In This Thread
Form radio buttons will not validate, need help. - by El Forum - 05-09-2012, 08:19 AM
Form radio buttons will not validate, need help. - by El Forum - 05-09-2012, 09:41 AM
Form radio buttons will not validate, need help. - by El Forum - 05-09-2012, 10:10 AM
Form radio buttons will not validate, need help. - by El Forum - 05-10-2012, 09:53 AM
Form radio buttons will not validate, need help. - by El Forum - 05-10-2012, 10:06 AM
Form radio buttons will not validate, need help. - by El Forum - 05-10-2012, 10:28 AM
Form radio buttons will not validate, need help. - by El Forum - 05-10-2012, 10:33 AM
Form radio buttons will not validate, need help. - by El Forum - 05-10-2012, 10:38 AM
Form radio buttons will not validate, need help. - by El Forum - 05-10-2012, 10:39 AM
Form radio buttons will not validate, need help. - by El Forum - 05-10-2012, 10:41 AM
Form radio buttons will not validate, need help. - by El Forum - 05-10-2012, 10:50 AM
Form radio buttons will not validate, need help. - by El Forum - 05-11-2012, 07:14 AM
Form radio buttons will not validate, need help. - by El Forum - 05-11-2012, 09:21 AM
Form radio buttons will not validate, need help. - by El Forum - 05-11-2012, 09:26 AM
Form radio buttons will not validate, need help. - by El Forum - 05-11-2012, 09:30 AM
Form radio buttons will not validate, need help. - by El Forum - 05-11-2012, 09:44 AM
Form radio buttons will not validate, need help. - by El Forum - 05-11-2012, 09:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB