Welcome Guest, Not a member yet? Register   Sign In
$this->db->update() works fine on dev server but doesn't update DB on live server
#1

[eluser]minimal design[/eluser]
Well, the title says it all Wink

It's a little download counter script. It works fine on my dev server so the functionality's fine, but I moved it live and nothing happens... I have a few PHP function disabled on server , could that be the problem?

Code:
show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open, allow_url_fopen

Other than that... any pointer would be much appreciated... not sure where I should start looking...

Thanks!
#2

[eluser]stuffradio[/eluser]
Did you correctly configure the database for the live server? Is the database schema the same in both environments?
#3

[eluser]minimal design[/eluser]
All the content is coming from the DB, custom CMS. Everything's retrieved from the DB without any problem... I used a SQL dump from local to live...

The problem really seem to be coming from the insert that doesn't work, I"m just a little at loss as where to start looking.

Thanks!
#4

[eluser]stuffradio[/eluser]
What is your code that is being used to update it?
#5

[eluser]minimal design[/eluser]
Here it is, but keep in mind the code does work... just not on the live server...

Code:
function get_file($id) {
    $f = $this->downloads_model->get_file_info($id);
    // download file
    $f_uri = 'uploads/downloads/'.$f['file_name'];
    $name = $f['file_name']; // name of downloaded file
    $file = file_get_contents($f_uri); // need to read file's contents to pass to force_download()
    force_download($name, $file);

    // add download count to DB
    $dl_total = $f['dl_all_times']+1;
    $dl_current = $f['dl_version']+1;
    $data = array(
              'dl_all_times' => $dl_total,
              'dl_version' => $dl_current
           );
    $this->db->update('downloads', $data, "id = $id");
}
#6

[eluser]minimal design[/eluser]
hold on a sec... it doesn't work locally anymore either... I had a regression somewhere and didn't notice until now... Might have something to do with 1.62 update?

gonna look into it...
#7

[eluser]minimal design[/eluser]
So... looks like if I just put the DB update code before the force download code, then it works again... Wouldn't that be a bug? I don't think I changed anything in my code when I updated to 1.62... and it worked fine before that...




Theme © iAndrew 2016 - Forum software by © MyBB