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

  • Home
  • SEARCH
  • 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 6474847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:38:08+00:00 2026-05-25T06:38:08+00:00

When a user registers, the script sends an email to verify his account. Clicking

  • 0

When a user registers, the script sends an email to verify his account. Clicking on the link, the script gets the token

$token = mysql_real_escape_string($_GET["token"]);

and what I thought to do is

if($token != '') {
mysql_query("UPDATE members SET verified = '' WHERE verified = '$token'");
}

or

if($token != '') {
    $result = mysql_query("UPDATE members SET verified = '' WHERE verified = '$token'");
    if($result) { }
    else { }
}

What is my purpose is to echo a success or failed message on the user. When it will be success then the verified will be empty.

What is the appropriate way of doing this with my examples above?

Should I check if there is the token in the DB before updating it?

Thank you.

  • 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-25T06:38:09+00:00Added an answer on May 25, 2026 at 6:38 am

    Your current method updates a record if it exists but does not take into account that which does not exist or match. You should run something similar to:

    if($token != '') {
        $result = mysql_query("SELECT COUNT(*) FROM members WHERE verified = '$token'");
    
        while($row = mysql_fetch_row($result)) {
           $records = $row[0];
        }
    
        if($records == 0) { echo 'no results'; }
        elseif($records ==1) { echo 'you matched'; then update the record. }
    }
    

    edit

    changed BACK to the while loop, wasn’t thinking of the count returning 0 rows

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

Sidebar

Related Questions

I'm writing a script where by a user registers his/her username, but a function
This is the standard scenario: User registers on the site User receives an account
Say a user registers for your site, you hash the password they have chosen
When a user registers with my site I want to offer them a login
I want to create sub-domains using PHP on the fly. Suppose a user registers
I have a .php that registers a user by calling another php function but
Every time a user registers to our site we need to show a NDA
I already have written a login and register script. The user can login to
So right now when a user registers, their password is hashed and stored, their
I have a php script that displays a web form to the user. When

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.