Welcome Guest, Not a member yet? Register   Sign In
Error Message
#1

(This post was last modified: 01-12-2018, 09:46 PM by ciadmin.)

I have loaded my website (REDACTED)from a backup to local server so I can edit. I had it developed in India and I didn't get a functional website. It runs but I can't load the products to it in mass. I want to rewrite the product database. that is the first of several problems. When I try to run it on mamp I get this message: 


A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: controllers/Index.php
Line Number: 8

<?php 


defined('BASEPATH') OR exit('No direct access');

class Index extends CI_Controller {

    public function __construct() {
parent::__construct();
    }

    public function index() {
$dataa = array(
    'bType' => '1'
);
$data['bannerF'] = $this->banner_model->viewRecordAnyR($dataa);
$dataa = array('category_id' => '6');
$data['necklace'] = $this->banner_model->viewRecordAny($dataa);
$dataa1 = array('category_id' => '7');
$data['earring'] = $this->banner_model->viewRecordAny($dataa1);
$dataa2 = array('category_id' => '8');
$data['rings'] = $this->banner_model->viewRecordAny($dataa2);
$dataa3 = array('category_id' => '9');
$data['bractlets'] = $this->banner_model->viewRecordAny($dataa3);
$dataa4 = array('banner_id' => '39');
$data['fiftyp'] = $this->banner_model->viewRecordAny($dataa4);
$dataa5 = array('banner_id' => '53');
$data['sixp'] = $this->banner_model->viewRecordAny($dataa5);
//$dataa4 = array('p_discount' => '50');
//$data['fiftyp'] = $this->product_model->viewRecordAnyR($dataa4);
$data['head_title'] = 'Online Shopping Site For Mobile, Laptops, Computers';
$this->load->view('front/index', $data);
    }

Reply
#2

Index is a reserved name.

Look: https://codeigniter.com/userguide3/gener...ight=index

And means that your DB credentials are wrong, maybe.
Reply
#3

This is a backup of the live site. Do I need to change the DB address somewhere in the local host?
Reply
#4

(01-13-2018, 01:14 AM)Sailor Wrote: This is a backup of the live site. Do I need to change the DB address somewhere in the local host?

Yes, it's in application\config\database.php

https://www.codeigniter.com/user_guide/d...cting.html
Reply
#5

I am still missing something. I still get the same error message.

|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $query_builder variables lets you determine whether or not to load
| the query builder class.
*/
$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost:8888/Ci/', (I have tried localhost, localhost:8888, and then localhost:8888/Ci/.
'username' => 'ss_dbname_14777f',
'password' => 'ss_dbname_14777f!@#',
'database' => 'ss_dbname_14777f',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
Reply
#6

It's localhost or 127.0.0.1 if this is a local MAMP server.
Normally username is "root" and password "root". If you are using this MAMP server.
Database name are whatever you imported it as, you did import it into your mysql server right?
Reply
#7

I still have a problem. The database is in MAMP/db/mysql56/mysq Is that the right location?
Reply
#8

That's not how you import a database...
Here's a video tutorial on how to export and import a database with phpmyadmin.
https://www.youtube.com/watch?v=NnOE0KWHGkY
Reply
#9

I watch the tutorial and I can backup and restore databases to my live website, but how do I import it to my site on MAMP?
Reply
#10

I imported the database and it still doesn't work. I am lost to what else to look for. I think I need to start from the beginning again and clear everything including the codeignter. (Take a shot of rum)

Step 1. I will reload codeignter on my localhost. (Take a shot of rum)

Step 2. Export the website from the live server. (Take a shot of rum)

Step 3. How do I get the website to the localhost correctly? (Take a shot of rum)

Step 4.I can import the database correctly to the localhost. (Good for two shots of rum)

Step 5.What do I need to change to run on the localhost? (Take a shot of rum)

Step 6. If the program runs drink the rest of the bottle of rum in celebration . If it doesn't, drink the bottle of rum in desperation.

Note: How hard can this be for someone that is new to codeighter to take a program that the Indian company wasn't able to get functional and fix it? No insulting responses PLEASE. LOL

Thanks for all the help.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB