Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 2.0.1 Database problem
#11

[eluser]jackeblagare[/eluser]
Code:
DEBUG - 2011-03-31 06:18:08 --> Config Class Initialized
DEBUG - 2011-03-31 06:18:08 --> Hooks Class Initialized
DEBUG - 2011-03-31 06:18:08 --> Utf8 Class Initialized
DEBUG - 2011-03-31 06:18:08 --> UTF-8 Support Enabled
DEBUG - 2011-03-31 06:18:08 --> URI Class Initialized
DEBUG - 2011-03-31 06:18:08 --> Router Class Initialized
DEBUG - 2011-03-31 06:18:08 --> Output Class Initialized
DEBUG - 2011-03-31 06:18:08 --> Input Class Initialized
DEBUG - 2011-03-31 06:18:08 --> Global POST and COOKIE data sanitized
DEBUG - 2011-03-31 06:18:08 --> Language Class Initialized
DEBUG - 2011-03-31 06:18:08 --> Loader Class Initialized
DEBUG - 2011-03-31 06:18:08 --> Controller Class Initialized
DEBUG - 2011-03-31 06:18:08 --> Database config for development environment is not found. Trying global config.
DEBUG - 2011-03-31 06:18:08 --> Database Driver Class Initialized
DEBUG - 2011-03-31 06:18:08 --> Model Class Initialized
DEBUG - 2011-03-31 06:18:08 --> Model Class Initialized
DEBUG - 2011-03-31 06:18:08 --> DB Transaction Failure
ERROR - 2011-03-31 06:18:08 --> Query error: No database selected
DEBUG - 2011-03-31 06:18:08 --> Language file loaded: language/english/db_lang.php
#12

[eluser]Kevin Smith[/eluser]
Add this to your controller right below the line where you pass username and password to the model:
Code:
$this->output->enable_profiler(TRUE);

And of the readouts give you any clues?
#13

[eluser]jackeblagare[/eluser]
Hmm. There is no output.
#14

[eluser]jackeblagare[/eluser]
It's working now. That was weird. I just retyped the values in my database.php file. Anyway, thanks for the help! Smile
#15

[eluser]John_Betong_002[/eluser]
Belt and braces Smile

Paste this at the end of your application/config/database.php
Code:
/* ********************************** */
// /*
    if(! defined('jj'))
    {
      define('jj', '<br />');
    }
    
    echo '<pre>';
      print_r($db['default']);
    echo '</pre>';

    echo jj, 'Connecting to database: ' .$db['default']['database'];
    echo jj;

    $dbh=mysql_connect
      (
        $db['default']['hostname'],
        $db['default']['username'],
        $db['default']['password'])
         or
        die('Cannot connect to the database because: ' . mysql_error());
    mysql_select_db ($db['default']['database']);
    
    echo jj,jj, 'Connected OK:';
    
    die(jj. jj.'file: ' .__FILE__ . '--&gt; Line: ' .__LINE__);
// */
/* ********************************** */
&nbsp;
&nbsp;
&nbsp;
#16

[eluser]jackeblagare[/eluser]
What's that for?
#17

[eluser]John_Betong_002[/eluser]
Quote:What’s that for?

It is the standard PHP/MYQL script to connect to your database. It is adapted to use values from your $db['default'] configuration.

If your database configuration settings are OK then you get the message 'Connected OK' otherwise a more informative message as to why you cannot connect to your database.

I have used it on numerous occasions when not being able to connect to a database.
&nbsp;
&nbsp;
&nbsp;




Theme © iAndrew 2016 - Forum software by © MyBB