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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:53:45+00:00 2026-05-23T02:53:45+00:00

I am verifying the email in database in form validation in CodeIgniter by using

  • 0

I am verifying the email in database in form validation in CodeIgniter by using callback in rule. For example

$this -> form_validation -> set_rules( 'email', 'Email address', 'trim|valid_email|callback_email_exists' );

The email_exists function is:

public function email_exists($email)
    {
        $this -> load -> model('account_model');
        $exists = $this -> account_model -> email_registered( $email );
        if ( $exists == true )
        {
            $this -> form_validation -> set_message ( 'email_exists', 'Email already exists.');
            return false;
        }
        return true;        
    }

It works fine. However, shouldn’t the above email_exists function be a private function instead of public?
I try to make it private like private function _email_exists($email) and i call back it by callback__email_exists

However I get the error:

Fatal error: Call to private method Account::_email_exists() from context 'CI_Form_validation' in ....(line number)

Can someone tell me what’s wrong?

  • 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-23T02:53:46+00:00Added an answer on May 23, 2026 at 2:53 am

    If you need to call it from outside the object (whether as callback or directly) it should be public

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

Sidebar

Related Questions

I am verifying my login authentication using ASP.net webservices. But the client requested to
At the moment, we are sending an email address verification email each time someone
I am writing an application which tests email addresses, for one part of this
Using SQL Server 2008, I have a requirement that email addresses in my user
For many of the sites we develop, we verify the user's email address. Typically
This question is about verifying the assembly to check whether it is tampered for
How do you go about verifying the type of an uploaded file reliably without
Routine maintenance on a website often involves verifying that links are valid, flagging bad
I am developing a C# Application and I was verifying the setting for publishing
I'm intrigued by the idea in TeamCity of pre-testing commits (i.e. verifying they don't

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.