Welcome Guest, Not a member yet? Register   Sign In
Script problem
#4

[eluser]TheFuzzy0ne[/eluser]
Oh, and in case you're wondering, $this->db->affected_rows() is passing back the number of affected rows from the last database query. Smile

Code:
function update_company($id) {
    $company_name = htmlspecialchars($this->input->post('company_name'));
    $company_city = htmlspecialchars($this->input->post('company_city'));
    $company_bio = htmlspecialchars(trim($this->input->post('company_bio')));
    $update_company = "UPDATE `user_company` SET"
        . " `company_name` = '".$company_name. "',"
        . " `company_city` = '".$company_city. "',"
        . " `company_state` = '".$this->input->post('company_state'). "',"
        . " `company_industry` = '".$this->input->post('company_industry'). "',"
        . " `company_years` = '".$this->input->post('company_years'). "',"
        . " `show_in_search` = '".$this->input->post('show_in_search'). "',"
        . " `company_bio` = '".$company_bio. "' WHERE (`user_id` = '".$id."')";
    $this->db->query($update_company); /* --The missing statement-- */
    $updated = $this->db->affected_rows($update_company);
    if($updated > 0) {
        return true;
    } else {
        return false;
    }
}
The above code is untested.


Messages In This Thread
Script problem - by El Forum - 02-21-2009, 02:26 PM
Script problem - by El Forum - 02-21-2009, 02:36 PM
Script problem - by El Forum - 02-21-2009, 02:37 PM
Script problem - by El Forum - 02-21-2009, 02:39 PM
Script problem - by El Forum - 02-21-2009, 02:47 PM
Script problem - by El Forum - 02-21-2009, 02:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB