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 8462963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:19:45+00:00 2026-06-10T14:19:45+00:00

Issue 1) I have set up a registration/login area and validated everything (including empty

  • 0

Issue 1) I have set up a registration/login area and validated everything (including empty fields) and hit a wall when displaying an error message if the username and/or password are incorrect. At the moment, i can get an error message to display if the fields are left blank but on submit the page redirects to the ‘private page’ either with correct or incorrect user details. This is my current code:

Issue 1 (RESOLVED):

Controller:

//This method will have the credentials validation
    public function credentials_validation() {
        $data['error'] ="Invalid Username or Password";
        $this->load->library('form_validation');
        $this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean|callback_username_check');
        $this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|callback_password_check');

          if($this->form_validation->run() == FALSE)
           {
             //Field validation failed.  User redirected to login page
             $this->index();

             }else{
                 $this->load->model('register_model');

                if($query = $this->register_model->validate()) {
                $this->load->model('news_model');

                $data = array('news' => $this->news_model->getArticle());
                $data['title'] = 'Admin | Home';
                $data['heading'] = 'News Articles';
                $data['main_content'] = 'admin/news';
                $this->load->view('include/template', $data);

                }else {
                $this->load->view('login',$data);
                }    

            }
    }

Issue 2) News Article Page only loads 1 article and url displays class name.

News Controller:

class News extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('admin/news_model');
    }

    public function index() {
        $data = array('news' => $this->news_model->getArticle());
        $data['title'] = 'Admin | News Home';
        $data['heading'] = 'News Articles';
        $this->load->view('admin/news', $data); 
}

}

The news model is just pulling the database table, select all and order by id and resulting in the array. Anyone have any ideas why this is only displaying 1 result? I think its something to do with the foreach method?

PS, No error messages displayed from CI or php error log!

  • 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-06-10T14:19:48+00:00Added an answer on June 10, 2026 at 2:19 pm

    The best way would be to store the error messages in an array e.g.

    $data['error'] ="Invalid Login";
    

    For example in the controller

    if($query = $this->register_model->check_membership()) {
        $data['main_content'] = 'signup_successful';
        $this->load->view('include/template', $data);
    
    }else {
        $data["error"]="Invalid User Id and Password combination";
        $this->load->view('signup',$data);
    }
    

    The check_membership function should check whether the login id and password combination are ok or not.

    And then in the signup view page, put something at the top like

    if (isset($error)){
        echo "<div class='error'>$error</div>";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of breakpoints which I used for debugging one issue. When
im having a little issue here. I have MediaElement.js set on my project. It
I have been facing issue with sphinx result set for string attribute. Below is
my issue lokks similar to this one: (link) but i have one-to-many association: <set
I have a issue with my code in C#. I have set up a
I am testing an EXE_BAD_ACCESS error. I have set NSZombieEnabled, MallocStackLogging, MallocStackLoggingNoCompact to YES.
I am testing an EXE_BAD_ACCESS error. I have set NSZombieEnabled, MallocStackLogging, MallocStackLoggingNoCompact to YES.
Possible Duplicate: table cell width issue I have a table set up as <html>
I have set up trac on my domain for issue tracking. How to I
I have an issue using an object property as jquery selector define([models/security/user, 'text!templates/security/registration.html'], function(SecurityUserModel,

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.