Help please..

Started on the old forum in November 2010 · view the original in the archive · old links redirect here

13 replies · 592 views · started 16 years ago · 1 min read

3 participants
rayjee Developer · 99 posts #1

"A Database Error Occurred Unable to connect to your database server using the provided settings."

database.php

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the "Database Connection"
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
|   ['hostname'] The hostname of your database server.
|   ['username'] The username used to connect to the database
|   ['password'] The password used to connect to the database
|   ['database'] The name of the database you want to connect to
|   ['dbdriver'] The database type. ie: mysql.  Currently supported:
             mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
|   ['dbprefix'] You can add an optional prefix, which will be added
|             to the table name when using the  Active Record class
|   ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
|   ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
|   ['cache_on'] TRUE/FALSE - Enables/disables query caching
|   ['cachedir'] The path to the folder where cache files should be stored
|   ['char_set'] The character set used in communicating with the database
|   ['dbcollat'] The character collation used in communicating with the database
|
| The $active_group variable lets you choose which connection group to
| make active.  By default there is only one group (the "default" group).
|
| The $active_record variables lets you determine whether or not to load
| the active record class
*/

$active_group = "default";
$active_record = TRUE;

$db['default']['hostname'] = "sql200.000space.com";
$db['default']['username'] = "space_6643768";
$db['default']['password'] = "tinapa";
$db['default']['database'] = "space_6643768_xl";
$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";

/* End of file database.php */
/* Location: ./system/application/config/database.php */

Added after 6 minutes:

Config.php

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
*/
$config['base_url']   = 'http://localhost/collegeportal/';

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = "index.php";

/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of "AUTO" works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO'         Default - auto detects
| 'PATH_INFO'      Uses the PATH_INFO
| 'QUERY_STRING'   Uses the QUERY_STRING
| 'REQUEST_URI'      Uses the REQUEST_URI
| 'ORIG_PATH_INFO'   Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol']   = "AUTO";

/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/

$config['url_suffix'] = "";

/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language']   = "english";

/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
*/
$config['charset'] = "UTF-8";

/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the "hooks" feature you must enable it by
| setting this variable to TRUE (boolean).  See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;

/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries.  For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';

/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify with a regular expression which characters are permitted
| within your URLs.  When someone tries to submit a URL with disallowed
| characters they will get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible.  By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';

/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string "words" that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['enable_query_strings'] = FALSE;
$config['controller_trigger']    = 'c';
$config['function_trigger']    = 'm';
$config['directory_trigger']    = 'd'; // experimental not currently in use

/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to 
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a t
rayjee Developer · 99 posts #3

..

Tnx bro, its ok n0w and c0nnected. But i got an error

A PHP Error was encountered Severity: Notice Message: Undefined variable: page_description Filename: views/header.php Line Number: 5 " /> A PHP Error was encountered Severity: Notice Message: Undefined variable: page_keywords Filename: views/header.php Line Number: 6 " />

and how about dis n config.php */ $config['base_url'] = 'http://localhost/collegeportal/';

firemax Developer · 221 posts #4

looks like your editing a application inside codeigniter. am i correct?

check your default controller file for missing variables 'page_description' & 'page_keywords'

controller code must like be (basically)

$data['page_description'] = "YOUR PAGE DESCRIPTION";
		$data['page_keywords'] = "YOUR PAGE KEYWORDS";
		$this->load->view('YOUR-DEFAULT-VIEW', $data);

External image (may be gone) Free Mobile Web Scripts by me: Free Youtube Downloader, Tweets Reader, Facebook Wall Posts Reader PHP Tutorials: [How to Secure Your PHP Script (PHP SECURITY)](http://coding-talk.com/f14/how-to-secure-you…

CreativityKills Lead · 833 posts #5

U use codeigniter. Any way in the controllers that calls the header.php view, do...

$header = array('page_description' => 'Your Description.');

$this->load->view('header.php', $header);
rayjee Developer · 99 posts #6

.

firemax wrote: looks like your editing a application inside codeigniter. am i correct?

check your default controller file for missing variables 'page_description' & 'page_keywords'

controller code must like be (basically)

$data['page_description'] = "YOUR PAGE DESCRIPTION";
		$data['page_keywords'] = "YOUR PAGE KEYWORDS";
		$this->load->view('YOUR-DEFAULT-VIEW', $data);

yes m8 ur ryt. Codeigniter,.Ok i will check it,,. But my 2nd problem is i cant access wen i click the link like example FORUM OR ANY LINK IN INDEX .. I think dis problem is my config.php */ $config['base_url'] = 'http://localhost/collegeportal/';

Added after 6 minutes:

and Tnx @kills ok i will check my controller,.

rayjee Developer · 99 posts #7

Tnx

All links r ok n0w.. Tnx. . But i cant fix the errors,, heres the header.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="<?=$page_description?>" />
<meta name="keywords" content="<?=$page_keywords?>" />
<title><?php echo $page_title ?></title>
<link href="<?php echo base_url();?>css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
   <div>
        <img src="<?php echo base_url();?>/images/banner.jpg" />
     </div>
   <div id="header">

folder controller/alumini.Php

<?php

class Alumni extends Controller {

   function Alumni()
   {
      parent::Controller();   
   }
   
   function index()
   {
   
      $info = $this->db_model->get_all_alumni();
      $data['page_title'] = "CCIT Alumni";
      $data['search_results'] = $info;
      
      $this->load->view('header',$data);
      $this->load->view('menu');
      $this->load->view('alumni/search_results');
      $this->load->view('footer');
   }
   
   function admin_search()
   {
      $info = $this->db_model->get_all_alumni();
      $data['page_title'] = "CCIT Alumni";
      $data['search_results'] = $info;
      
      $this->load->view('header2',$data);
      $this->load->view('menu2');
      $this->load->view('alumni/admin_search');
   }

   function admin_view_profile()
   {   
      $info = $this->db_model->get_user_info($this->uri->segment(3));
      $data['page_title'] = "CICT Alumni";
      $data['user_info'] = $info;
      
      $this->load->view('header2',$data);
      $this->load->view('menu2');
      $this->load->view('alumni/admin_view_profile');   
   }

   function view_profile()
   {   
      $info = $this->db_model->get_user_info($this->uri->segment(3));
      $data['page_title'] = "CCIT Alumni";
      $data['user_info'] = $info;
      
      $this->load->view('header',$data);
      $this->load->view('menu');
      $this->load->view('alumni/view_profile');
      $this->load->view('footer');   
   }
   
   function view_photos()
   {   
      $info = $this->db_model->get_user_info($this->uri->segment(3));
      $data['page_title'] = "CCIT Alumni";
      $data['user_info'] = $info;
      
      $this->load->view('header',$data);
      $this->load->view('menu');
      $this->load->view('alumni/photos');
      $this->load->view('footer');   
   }
   
   function send_messages()
   {   
      if ($this->session->userdata('logged_in')==TRUE)
      {         
         $info = $this->db_model->get_user_info($this->uri->segment(3));
         $data['page_title'] = "CCIT Alumni";
         $data['user_info'] = $info;
         
         $this->load->view('header',$data);
         $this->load->view('menu');
         $this->load->view('alumni/send_message');
         $this->load->view('footer');
      }
      else
      {
         $data['page_title'] = "CCIT Alumni";
         $data['notice'] = "Please log in to your account";
         $this->load->view('header',$data);
         $this->load->view('login',$data);
         $this->load->view('footer');
      }   
   }
   
   function message_send()
   {
      $this->db->set('student_id',$this->input->post('student_id'));
      $this->db->set('subject',$this->input->post('subject'));
      $this->db->set('message',$this->input->post('message'));
      $this->db->set('status','Unread');
      $this->db->set('from',$this->session->userdata('student_id'));
      $this->db->set('date',date('Y-m-d'));
      $this->db->insert('messages');
      redirect('alumni/view_profile/'.$this->input->post('student_id'));
   }
   
   function search()
   {
      $name = $this->input->post('searchbox');
      $course = $this->input->post('course');
      $andby = $this->input->post('andby');
      $andbyval = $this->input->post('andbyval');
      
      if (($name == "") && ($course == "") && ($andby == "" || $andbyval =="" )){
         $info = false;
      }
      else{
         $info = $this->db_model->search_alumni($name, $course, $andby, $andbyval);
      }
      
      $data['page_title'] = "CICT Alumni";
      $data['search_results'] = $info;
      
      $this->load->view('header',$data);
      $this->load->view('menu');
      $this->load->view('alumni/search_results');
      $this->load->view('footer');
   }
   function admin_search_all()
   {
      $year = $this->input->post('searchbox');
      $course = $this->input->post('course');
      $employed = $this->input->post('employed');
      
      if (($year == "") && ($course == "") && ($employed == "")){
         $info = false;
      }
      else{
         $info = $this->db_model->admin_search($year, $course, $employed);
      }
      
      $data['page_title'] = "CCIT Alumni - Administrator";
      $data['search_results'] = $info;
      
      $this->load->view('header',$data);
      $this->load->view('menu2');
      $this->load->view('alumni/admin_search');
   }
   
   function admin_home2()
   {
   

      $data['page_title'] = "CICT Alumni - Administrator";
   
      $this->load->view('alumni/admin_home2');

   }
   function admin_alumni_photos()
   {   
      $info = $this->db_model->get_user_info($this->uri->segment(3));
      $data['page_title'] = "CCIT Alumni-Administrator";
      $data['user_info'] = $info;
      
      $this->load->view('header2',$data);
      $thi
firemax Developer · 221 posts #8

replace this 'index' function in alumini.php

function index() 
   { 
    
      $info = $this->db_model->get_all_alumni(); 
      $data['page_description'] = "YOUR PAGE DESC HERE"; 
      $data['page_keywords'] = "YOUR KEYWORDS HERE"; 
      $data['page_title'] = "CCIT Alumni"; 
      $data['search_results'] = $info; 
       
      $this->load->view('header',$data); 
      $this->load->view('menu'); 
      $this->load->view('alumni/search_results'); 
      $this->load->view('footer'); 
   } 

External image (may be gone) Free Mobile Web Scripts by me: Free Youtube Downloader, Tweets Reader, Facebook Wall Posts Reader PHP Tutorials: [How to Secure Your PHP Script (PHP SECURITY)](http://coding-talk.com/f14/how-to-secure-you…

rayjee Developer · 99 posts #9

.

Its ok n0w m8. Thank you.. But forum page an articles still have same errors.. And cant access to signup.php? An Error Was Encountered Unable to load the requested file: members \signup.php

signup.php

   <div id="menu_bg">
      <div id="menu">
       Step 1. Please fill out the form.
      </div>
   </div>
   <div id="content" align="center">
   
   <script type="text/javascript">
   <!-- Hide script from old browsers
      var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
      var phoneRegEx = /^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/;
      var RegEx = /[a-zA-Z0-9_]{6,20}$/;
      //var mobileRegEx = /^\(?(\d{4})\)?[\.\-\/ ](\d{7})$/;
      
      function validate(frm)
      {
                  
         if (frm.student_id.value=="")
         {   
            alert("Please provide your student id.");
            frm.student_id.focus();
            return false;
         }
         
         if (frm.lname.value=="")
         {   
            alert("Please provide your last name.");
            frm.lname.focus();
            return false;
         }
         
         if (frm.fname.value=="")
         {   
            alert("Please provide your first name.");
            frm.fname.focus();
            return false;
         }
         
         if (frm.mname.value=="")
         {   
            alert("Please provide your middle name.");
            frm.mname.focus();
            return false;
         }
            
         if (frm.address.value=="")
         {   
            alert("Please provide your address.");
            frm.address.focus();
            return false;
         }
         
         if (frm.email.value=="")
         {   
            alert("Please provide your email.");
            frm.email.focus();
            return false;
         }
         
         if (validateEmail(frm.email.value)==false)
         {   
            alert("Please provide a valid email.");
            frm.email.focus();
            return false;
         }
         
         /*if (validatePhone(frm.phone.value)==false)
         {   
            alert("Please provide a valid phone number.");
            frm.phone.focus();
            return false;
         }
         else
         {
            validPhone = phoneRegEx.exec(frm.phone.value);
            frm.phone.value = "(" + validPhone[1] + ") " + validPhone[2] + "-" + validPhone[3];
         }
         
         if (validateMobile(frm.mobile.value)==false)
         {   
            alert("Please provide a valid mobile number.");
            validPhone = mobileRegEx.exec(frm.mobile.value);
            alert(validPhone);
            frm.mobile.focus();
            return false;
         }
         else
         {
            validPhone = mobileRegEx.exec(frm.mobile.value);
            frm.mobile.value = "(" + validPhone[1] + ") "+ validPhone[3];
         }*/
                     
         if (frm.civil_status.value==0)
         {   
            alert("Please provide your civil status.");
            frm.civil_status.focus();
            return false;
         }
         
         if (frm.gender.value==0)
         {   
            alert("Please provide your gender.");
            frm.gender.focus();
            return false;
         }
                  
         if (frm.username.value=="")
         {   
            alert("Please provide your username.");
            frm.username.focus();
            return false;
         }
         else
         {
            var str = frm.username.value
             if (str.length <6)
            {
               alert("Your username should contain atleast 6 characters.");
               frm.username.focus();
               return false;
            }
         }
         
         if (validateInput(frm.username.value)==false)
         {
            alert("Your username contains invalid characters.");
            frm.username.focus();
            return false;
         }
               
         if (frm.password.value=="")
         {   
            alert("Please provide your password.");
            frm.password.focus();
            return false;
         }      
         else
         {
            var str = frm.password.value
            if (str.length <6)
            {
               alert("Your password should contain atleast 6 characters.");
               frm.password.focus();
               return false;
            }
         }
         
         if (validateInput(frm.password.value)==false)
         {
            alert("Your password contains invalid characters.");
            frm.password.focus();
            return false;
         }
         
         if (frm.conf_password.value=="")
         {   
            alert("Please confirm your password.");
            frm.conf_password.focus();
            return false;
         }
         
         if (frm.password.value!=frm.conf_password.value)
         {
            alert("Passwords do not match.");
            frm.password.value="";
            frm.conf_password.value="";
            frm.password.focus();
            return false;
         }
         
         if (frm.security_question.value==0)
         {
            alert("Please select a question");
            frm.security_question.focus();
            return false;
         }
         
         if (frm.security_answer.value=="")
         {
            alert("Please answer the security question");
            frm.security_answer.focus();
            return false;
rayjee Developer · 99 posts #14

..

Ur pm to me bro about slash its ryt, i check my members.Php .Tnx.. Members.php

   function signup()
   {
      $data['page_title'] = "CICT Alumni";
      $this->load->view('header',$data);
      $this->load->view('members\signup',$data);
      $this->load->view('footer');
   }
   
   function edit_login_info()
   {
      $info = $this->db_model->get_user_info($this->session->userdata('student_id'));

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close