Note that there are some explanatory texts on larger screens.

plurals
  1. POStrange Database problem! PHP MySQL Codeigniter
    text
    copied!<p>I am experiencing a strange problem with a simple query that returned the number of rows in a table.</p> <p>This was always working fine and correct.</p> <p>However! Yesterday I added a new function to my website that updates a column in existing rows in my table. This function called <strong>add_file()</strong></p> <p>Now my website is giving a wrong value of what it should be: </p> <p>Currently there are <strong>76</strong> rows in my table called "procedure" viewed from phpMyadmin and SQLyog.</p> <p>However in my website it is saying there are <strong>70</strong>. </p> <blockquote> <p>Machines DO NOT LIE, so this is most likely my doing</p> </blockquote> <p>I have a hunch that my function called <strong>add_file()</strong> is to blame.</p> <p>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.</p> <pre><code> 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' =&gt; ($this-&gt;session-&gt;userdata('name').$this-&gt;input-&gt;post('record_id')).$extension ); //find row that matches the row just submitted by user $this-&gt;db-&gt;where('procedure_id',$this-&gt;input-&gt;post('record_id')); //update that row with the filename of the document uploaded $this-&gt;db-&gt;update('procedure', $filename); } </code></pre> <p>If you look at this screenshot you will see my "edocument" column from 72-76 has values.</p> <p><a href="http://i.imgur.com/pBzVs.jpg" rel="nofollow">http://i.imgur.com/pBzVs.jpg</a></p> <p>So is the update function breaking my database?</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload