0

A piece of database setting in my CodeIgniter development environment.

$db['development']['pconnect'] = TRUE;
$db['development']['db_debug'] = TRUE;
$db['development']['cache_on'] = FALSE;

But there is a model that I should turn the value of 'db_debug' into FALSE, because the debug info will interrupt the execution of my PHP code. How can I do that?

I have Google it for a long time, I am quite appreciate that someone could solve my problem.

user3024431
  • 461
  • 4
  • 8
  • Hmm, if `db_debug` interrupts code execution in a particular model, I would recommend finding what is wrong with that model and fixing it. Post the offending model code. – Michael Berkowski Feb 14 '14 at 03:39
  • Since I use the transaction feature of MySQL, it will be rollback when SQL execute failed. However, if the db_debug is TRUE, my database operation will not be rollback, but interrupted. – user3024431 Feb 14 '14 at 04:43

1 Answers1

1

You can access db_debug as a public variable:

$this->db->db_debug = FALSE;
László Papp
  • 51,870
  • 39
  • 111
  • 135
  • Why have you just not marked the question as duplicate then? – László Papp Feb 14 '14 at 08:03
  • Good point. I read this: http://meta.stackexchange.com/questions/10841/how-should-duplicate-questions-be-handled ... and as my account is too new I can't make comments and thus I simply tried to answer the question instead with a link since no one else had answered it. But normally I would agree, I just can't make comments yet (except on my own answers apparently). – Erik Brickarp Feb 14 '14 at 11:48
  • hmm, right, you might not be able to flag it either. In that case, just gain the necessary minimum reputation first. I gave a +1 for now to be closer to avoid this in the future, but do not take it as an acceptable way in general. :-) I also marked the question as duplicate with your finding. Thanks for this. – László Papp Feb 14 '14 at 11:56
  • Roger that, thanks for being kind to a rookie, most appreciated Laszlo. – Erik Brickarp Feb 14 '14 at 15:35