ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to setup mysql database in wamp with codeigniter?

June 23, 2009 2:29am

Subscribe [1]
  • #1 / Jun 23, 2009 2:29am

    neodregan

    4 posts

    I’m following the tutorial on devshed, but when I go to “http://localhost/ci/index.php/helloworld/”. I get the error, “
    A Database Error Occurred

    Unable to connect to your database server using the provided settings.
    “.

    These are the settings that I have in databases.php:

    $db[‘default’][‘hostname’] = “localhost”;
    $db[‘default’][‘username’] = “root”;
    $db[‘default’][‘password’] = “root”;
    $db[‘default’][‘database’] = “mydatabase”;
    $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”;


    I went to phpMyAdmin in wamp and added the mydatabase mysql database and tried to add a password, but after that happened. It said a password was not set for mydatabase.

    Can anyone tell me how to set this up in wamp correctly?

  • #2 / Jun 23, 2009 2:38am

    Dam1an

    2385 posts

    Try connecting without the password then
    There is no password by default with XAMPP either, and it works fine without it

  • #3 / Jun 23, 2009 3:13am

    neodregan

    4 posts

    Now I get this error:

    An Error Was Encountered

    Unable to load the requested file: helloworld.php

  • #4 / Jun 23, 2009 3:37am

    Thorpe Obazee

    1138 posts

    You need to create the helloworld.php. Particularly, which devshed tutorial are you talking about?

  • #5 / Jun 23, 2009 3:50am

    neodregan

    4 posts

    I’m on this part. http://www.devshed.com/c/a/PHP/Introduction-to-the-CodeIgniter-PHP-Framework/3/

    I put the helloworld.php under the controllers folder with this code.

    <?php
    
    class HelloWorld extends Controller{
    
    function HelloWorld(){
    
    // load controller parent
    
    parent::Controller();
    
    }
    
    function index(){
    
    $data['title']='My first application created with Code Igniter';
    
    $data['message']='Hello world!';
    
    // load 'helloworld' view
    
    $this->load->view('helloworld',$data);
    
    }
    
    }
    
    ?>


    And under the views folder, I put this in the index.html file:

    <html>
    <head>
        <title><?php echo $title;?></title>
    </head>
    <body>
    
    <h1><?php echo $message?></h1>
    
    </body>
    </html>

    Still no go.

  • #6 / Jun 23, 2009 4:02am

    Thorpe Obazee

    1138 posts

    you’ll need to have a helloworld.php file in the views folder. Copy that content in a helloworld.php file.

  • #7 / Jun 23, 2009 4:07am

    neodregan

    4 posts

    I did what you said, now I receive this!

    Fatal error: Cannot redeclare class HelloWorld in C:\wamp\www\ci\system\application\views\helloworld.php on line 25

  • #8 / Jun 23, 2009 4:53am

    Thorpe Obazee

    1138 posts

    I did what you said, now I receive this!

    Fatal error: Cannot redeclare class HelloWorld in C:\wamp\www\ci\system\application\views\helloworld.php on line 25

    <html>
    <head>
        <title><?php echo $title;?></title>
    </head>
    <body>
    
    <h1><?php echo $message?></h1>
    
    </body>
    </html>

    Copy only this

  • #9 / Jun 23, 2009 4:54am

    Dam1an

    2385 posts

    I’m guessing you misunderstood what bargainph said, you should rename the view to helloword.php, not copy the helloworld.php controller

    Edit: Darn it, beat by Bargainph

  • #10 / Jun 23, 2009 4:55am

    Thorpe Obazee

    1138 posts

    I’m guessing you misunderstood what bargainph said, you should rename the view to helloword.php, not copy the helloworld.php controller

    Edit: Darn it, beat by Bargainph

    😛

  • #11 / Jun 23, 2009 9:49am

    neodregan

    4 posts

    It worked! Thanks guys!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases