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

The Archive Base Latest Questions

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

I am having major trouble selecting the most current/matching row in my database. For

  • 0

I am having major trouble selecting the most current/matching row in my database.

For example:

$query = "SELECT * FROM `Password_Reset`";
    $request = mysql_query($query,$connection) or die(mysql_error());
    $result = mysql_fetch_array($request);

$result['token'] is taking the first row’s no matter what every time the query is run.

I am pretty sure it has to do with not being specific enough with my select query but I have not found a way to match it up.

to be even MORE specific. This is the whole query:

$query = "SELECT * FROM `Password_Reset`";
    $request = mysql_query($query,$connection) or die(mysql_error());
    $result = mysql_fetch_array($request);

    $token = $result['token'];

    $alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcedfghijklmnopqrstuvwxyz1234567890";
    $rand = str_shuffle($alpha);
    $salt = substr($rand,0,40);
    $hashed_password = sha1($salt . $_POST['Password']);
    $user_email = $result['email'];





       // these should match, and do so every where else on my other pages and in the db, I'm just not able to pull the corresponding $token. its taking the $token in the first row every time.
    if($get_token == $token) {
    header("Location: http://www.cysticlife.org/index.php");    
    exit;
    }else{

    if(empty($_POST['Password'])) {
        $valid = false;
        $error_msgs[] = 'Whoops! You must enter a password.';
    }

    if($_POST['Password'] != $_POST['passwordConfirm'] || empty($_POST['Password'])) {
        $valid = false;
        $error_msgs[] = "Your password entries didn't match...was there a typo?";
    }

    if($valid) {
        $query = "UPDATE `cysticUsers` SET `encrypted_password` = '$hashed_password' WHERE `Email` = '$user_email'";

        mysql_query($query,$connection);
    }


    }
}

thanks in advance

  • 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-19T22:43:40+00:00Added an answer on May 19, 2026 at 10:43 pm

    If you want to order your rows by when they were submitted to the database, you will need to add an ID-Field to your table, if you haven’t got one already.

    It will probably be the easiest way to add an field called id to the table, set it as index and use auto_increment. Then, you can simply order your rows by ID:

    SELECT * FROM `Password_Reset` ORDER BY `id` ASC
    

    Btw, if you only need the first row, it’s good to add a LIMIT 1 to your query, for better performance.

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

Sidebar

Related Questions

Background I'm having trouble understanding the primary key choices in the database for a
I've been having nothing but trouble with python2.6 and Snow Leopard. One major problem
I'm having some major trouble deleting directories. I'm working building a ADMIN tool to
This is giving me major headaches! I'm having trouble even describing the problem in
having major issues with my query processing time :( i think it is because
I'm having trouble coming up with a query to determine what records are missing
I'm having major rendering issues in Safari with the web application I'm working on.
I'm currently having a major issue with a python script. The script runs arbitrary
Having to upgrade a database schema makes installing a new release of software a
I'm having a lot of trouble getting my compiled assembly file working on SPIM.

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.