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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:19:43+00:00 2026-05-20T22:19:43+00:00

I a have update form for account information. Under one form i have name,

  • 0

I a have update form for account information. Under one form i have name, username, email, company, password. Let’s say all i want to do is change my name, i still use that form and all other fields stay the same. In the update form i have an email and username checker which make sure they aren’t already taken. So now, even if i don’t change my email address or username its getting submitted to the checker code.

How can I fix it so that it doesn’t prevent it if it belongs to the same person:

   // checks if the email is in use
  if (!get_magic_quotes_gpc()) {
  $_POST['email'] = addslashes($_POST['email']);
  }
  $emailcheck = $_POST['email'];
  $check = mysql_query("SELECT email FROM accounts WHERE email = '$emailcheck'")
  or die(mysql_error());
  $check2 = mysql_num_rows($check);

  //if the name exists it gives an error
  if ($check2 != 0) {
  print("here i basically show the form once again highlighting the error)");
  die('');
   }
  • 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-20T22:19:44+00:00Added an answer on May 20, 2026 at 10:19 pm

    i dont know how ur db is formatted but add username to sql should do it

     // checks if the email is in use
      if (!get_magic_quotes_gpc()) {
      $_POST['email'] = addslashes($_POST['email']);
      }
      $emailcheck = $_POST['email'];
      $check = mysql_query("SELECT email FROM accounts WHERE email = '$emailcheck' 
                            AND NOT(user='$username')")
      or die(mysql_error());
      $check2 = mysql_num_rows($check);
    
      //if the name exists it gives an error
      if ($check2 != 0) {
      print("here i basically show the form once again highlighting the error)");
      die('');
       }
    

    Therefore it will look where the email is not in the row of that specific user 🙂

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

Sidebar

Related Questions

My User model contains :name, :email, and :password fields. All 3 have validations for
I have a form where a user can create an account. The username column
I have a form that enables a user to update multiple alert rules records
I have a MDI container form, and some child forms that update their title
I have two forms in one view updating the User Profile. One Form is
how to display error onto another page? I have a form under user folder
I have a form with user details and an update statement that will update
In my controller I have: def index @owner = current_user @accounts = @owner.accounts.all( :name.not
Update the question Hello All, I would like improve my email address validation code.
Let's say I have a User model, with a facebook_uid field corresponding to the

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.