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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:49:14+00:00 2026-06-17T20:49:14+00:00

I am currently writing a isRegistered function. This function is written within a class

  • 0

I am currently writing a isRegistered function. This function is written within a class called User. This is the code:

public function isRegistered($email){
        $ir =   $this->db->prepare('select * from users where email=?');
        $ir->bindParam(1, $email);
        $ir->execute();
        if ($ir->rowCount()==1){
            return true;
        }
        else { return false;}
}//end of function isRegistered 

I am instantiating the class and this function on the register page, and I am trying to do this:

    if(!empty($_POST['email'])){
        $email  =   $_POST['email'];
        $fp =   new User();
        $fp->isRegistered($email);
        if($fp==1){
        echo "email exists";    
        }
        else {echo "email doesn't exist.";}
    }
    else echo "Please enter an email address.";

Obviously this is not working. How do I get it to work? What is the right way to do it?
I know I am returning either a true or a false from the method isRegistered. I just don’t know how to pick that response up when I instantiate it.

  • 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-17T20:49:15+00:00Added an answer on June 17, 2026 at 8:49 pm

    I think you want:

    if($fp->isRegistered($email)){
       ...
    

    Or assign the return value of your function to $fp…

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

Sidebar

Related Questions

I'm currently writing a Powershell script that's used to select a user from Active
I'm currently writing a function what would create a zip file, which will be
I'm currently writing a billing application using EF 5 Code First, and I'm running
I am currently writing a program's main function(the bare-bone function so far) so far
I am currently writing an application that needs to be able to select a
So I am currently writing a part of a program that takes user text
I am currently writing code to transfer data to a remote vendor. The transfer
I'm currently writing some MATLAB code to interact with my company's internal reports database.
I am currently writing a chatbox plugin for Wordpress. This plugin uses a jQuery.post()
I am currently writing some code that can access a separate workbook through an

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.