Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3667458
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:00:12+00:00 2026-05-19T02:00:12+00:00

First off, does anyone know of a good place to get help with CodeIgniter?

  • 0

First off, does anyone know of a good place to get help with CodeIgniter? The official community forums are somewhat disappointing in terms of getting many responses.

I have ci installed on a regular MAMP stack, and I’m working on this tutorial. However, I have only gone through the Created section, and currently I am getting a No database selected error.

Model:

<?php 
class submit_model extends Model {

    function submitForm($school, $district) {
        $data = array(
            'school' => $school,
            'district' => $district
        );

        $this->db->insert('your_stats', $data);
    }

} 

View:

<?php $this->load->helper('form'); ?>

<?php echo form_open('main'); ?>

    <p>
        <?php echo form_input('school'); ?>
    </p>

    <p>
        <?php echo form_input('district'); ?>
    </p>

    <p>
        <?php echo form_submit('submit', 'Submit'); ?>
    </p>

<?php echo form_close(); ?> 

Controller:

<?php
class Main extends controller {

    function index() {

        // Check if form is submitted
        if ($this->input->post('submit')) {
            $school = $this->input->xss_clean($this->input->post('school'));
            $district = $this->input->xss_clean($this->input->post('district'));

            $this->load->model('submit_model');
            // Add the post
            $this->submit_model->submitForm($school, $district);
        }
        $this->load->view('main_view');
    }
} 

database.php

$db['default']['hostname'] = "localhost:8889";
$db['default']['username'] = "root";
$db['default']['password'] = "root";
$db['default']['database'] = "stats_test";
$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"; 

config.php

$config['base_url']    = "http://localhost:8888/ci/";
...
$config['index_page'] = "index.php";
...
$config['uri_protocol']    = "AUTO"; 

So, how come it’s giving me this error message?

A Database Error Occurred
Error Number: 1046

No database selected

INSERT INTO `your_stats` (`school`, `district`) VALUES ('TJHSST', 'FairFax') 

Is there any way for me to test if CodeIgniter can actually detect the mySQL databases I’ve created with phpMyAdmin in my MAMP stack?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:00:13+00:00Added an answer on May 19, 2026 at 2:00 am

    First check the obvious – is there a database stats_test, and can you connect using the details in your config? You may have a problem with user permissions. Also check that you have a line $active_group = 'default'; at the beginning of the database.php file, which says to use those connection parameters.

    By the way, I’d suggest setting $db['default']['pconnect'] to false instead of true. Lots of people have had connection problems using that, particularly if you have other non-CI parts of the website using a regular connection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, I know next to nothing about language theory, and I barely know
First off, I am using Windows XP. I have multiple hard drives and it
First off, I understand the reasons why an interface or abstract class (in the
First off if you're unaware, samba or smb == Windows file sharing, \\computer\share etc.
First off, there's a bit of background to this issue available on my blog:
First off: I'm using a rather obscure implementation of javascript embedded as a scripting
First off, I'm working on an app that's written such that some of your
First off, let me start off that I am not a .net developer. The
First off, this question is ripped out from this question. I did it because
First off, I apologize if this doesn't make sense. I'm new to XHTML, CSS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.