I am experiencing a strange problem with a simple query that returned the number of rows in a table.
This was always working fine and correct.
However! Yesterday I added a new function to my website that updates a column in existing rows in my table. This function called add_file()
Now my website is giving a wrong value of what it should be:
Currently there are 76 rows in my table called "procedure" viewed from phpMyadmin and SQLyog.
However in my website it is saying there are 70.
Machines DO NOT LIE, so this is most likely my doing
I have a hunch that my function called add_file() is to blame.
What this function does is update the "edocument" column in my procedure table if a user uploads a file corresponding to that record. So that the system knows what that file is called and can construct a url for it.
public function add_filename($file)
{
//This is the extension of the file retrieved from an array
$extension = $file['upload_data']['file_ext'];
//variable for updating row which is constructed from Username+Filename+Extension
$filename = array
(
'edocument' => ($this->session->userdata('name').$this->input->post('record_id')).$extension
);
//find row that matches the row just submitted by user
$this->db->where('procedure_id',$this->input->post('record_id'));
//update that row with the filename of the document uploaded
$this->db->update('procedure', $filename);
}
If you look at this screenshot you will see my "edocument" column from 72-76 has values.
https://i.stack.imgur.com/nxDnE.jpg
So is the update function breaking my database?
Thanks