Note that there are some explanatory texts on larger screens.

plurals
  1. POCode Igniter Load Database seem to stop process thread
    primarykey
    data
    text
    <p>I've just set up a simple PHP Code Igniter project on a Windows 7 box, IIS 7, Fast CGI, no modules.</p> <p>when I load up database in one of the function of a Model class by doing such <code>this-&gt;load-&gt;database()</code> the thread seem to stop on that particular line. None of the subsequent operations are done.</p> <pre><code>class Account_model extends Model { var $userId = ''; var $userName = ''; var $requestToken = ''; var $accessToken = ''; var $enabled = false; var $startOfDay; var $endOfDay; function Account_model() { parent::Model(); } function get($userId) { $this-&gt;load-&gt;database(); $query = $this-&gt;db-&gt;get_where('accounts', array('userId' =&gt; $userId), 1, 0); return $query-&gt;result(); } function insert() { $this-&gt;load-&gt;database(); // ** stop ** $this-&gt;db-&gt;insert('accounts', $this); //never gets to this } } </code></pre> <p>If I simply ommit that line altogether, I get a php exception undefined variable $db in model.</p> <p>The caller controller:</p> <pre><code>class SignUp extends Controller { function SignUp() { parent::Controller(); } function createUser() { echo 'processing'; $this-&gt;load-&gt;model('Account_model'); $this-&gt;Account_model-&gt;userId = 'asd'; $this-&gt;Account_model-&gt;userName = 'test_user_pls_delete'; $this-&gt;Account_model-&gt;enabled = true; $this-&gt;Account_model-&gt;startOfDay = time(); $this-&gt;Account_model-&gt;insert(); echo 'done'; // never gets to this } } </code></pre> <p>I've verified the database configuration is correct (host name, driver, etc), and able to connect to the database server from the machine using MySQL workbrench.</p> <pre><code>$active_group = "default"; $active_record = TRUE; $db['default']['hostname'] = "{omitted}"; $db['default']['username'] = "{omitted}"; $db['default']['password'] = "{omitted}"; $db['default']['database'] = "{omitted}"; $db['default']['dbdriver'] = "mysql"; $db['default']['dbprefix'] = ""; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ""; $db['default']['char_set'] = "utf8"; $db['default']['dbcollat'] = "utf8_general_ci"; </code></pre> <p>The database table name: accounts</p> <ul> <li>Id int(11) primary key auto_increment</li> <li>UserId varchar(255) utf8_general_ci</li> <li>userName varchar(255) utf8_general_ci</li> <li>requestToken varchar(255) utf8_general_ci</li> <li>AccessToken varchar(255) utf8_general_ci</li> <li>Enabled tinyint(1)</li> <li>startOfDay time</li> <li>endOfDay time</li> </ul> <p>Any ideas on how to fix this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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