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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:04:32+00:00 2026-05-23T13:04:32+00:00

The code below is supposed to check whether the name already exists in the

  • 0

The code below is supposed to check whether the name already exists in the database, and if it is already there then set a boolean. But it does set the boolean even if the name does not exist; I’ve verified this many times. So I think it must be my code that’s wrong. I understand the line below as a check to see

if ($row = mysql_fetch_assoc($result))

I think this line is checking whether there was result found at all. If a result is found then the conditional evaluates to TRUE, so $row gets assigned. Is that correct?

Do you see any other problems with the code or something that is done badly? I’m suspicious of the line that contains the mysql_query since sometimes, when you search for a name that’s not in the table of the database, it still enters the if block.

$udid_mismatch = false;
$name_found = false;
$result = mysql_query("SELECT udid 
                         FROM $table 
                        WHERE name='$name'");

if($row = mysql_fetch_assoc($result)) {
  $name_found = true;

  if($row['udid'] != $udid) {
    $udid_mismatch = true;
  }
}
  • 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-23T13:04:32+00:00Added an answer on May 23, 2026 at 1:04 pm
    $udid_mismatch = $name_found = false;
    
    $result = mysql_query("SELECT `udid `
                             FROM `$table `
                            WHERE `name` = '$name'");
    
    if (mysql_num_rows($result) > 0) {
        $name_found = true;
        while ($row = mysql_fetch_assoc($result)) {
            if ($row['udid'] != $udid) {
                $udid_mismatch = true;
                break;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The function below checks whether the id entered is already in the database, and
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {
The code below works. But if I comment out the line Dim objRequest As
The code below is supposed to send out an email if a comment is
The code below is supposed to show a stack of three list boxes, each
Code below is not working as expected to detect if it is in design
The code below shows a sample that I've used recently to explain the different
The code below gives me this mysterious error, and i cannot fathom it. I
The code below gives an error: Property 'Int32 Key' is not defined for type
The code below is the code i am using. It works fine in thunderbird

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.