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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:34:03+00:00 2026-05-30T12:34:03+00:00

Here is what I’m trying to do: When user adds a contact to his

  • 0

Here is what I’m trying to do: When user adds a contact to his list, the number of this contact gets run by with the numbers in the database and it gives feedback if the user is already in the database or not. Right now I always get back “User is in database” even though he isn’t. Then again I’m not that well acquainted with php. I changed the code a bit again, now it doesn’t work at all, because it doesn’t like the part

$number = ($_GET["number"] from $DB_Table);

Full code

<?php
$DB_HostName = "localhost";
$DB_Name = "db";
$DB_User = "user";
$DB_Pass = "pw";
$DB_Table = "contacts";

$number = ($_GET["number"] from $DB_Table);

$fnumber = ($_GET["fnumber"]);

if ($number == $fnumber) {
    echo "This user is already in database";
} else {
echo "This user isn't in the database"; 
}

$con = mysql_connect($DB_HostName,$DB_User,$DB_Pass) or die    (mysql_error()); 
mysql_select_db($DB_Name,$con) or die(mysql_error()); 

mysql_close($con);
?>
  • 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-30T12:34:05+00:00Added an answer on May 30, 2026 at 12:34 pm

    I don’t actually see you executing the database query. You could do something like this:

    <?php
    
        $DB_HostName = "localhost";
        $DB_Name = "db";
        $DB_User = "user";
        $DB_Pass = "pw";
        $DB_Table = "contacts";
    
        $con = mysql_connect($DB_HostName,$DB_User,$DB_Pass) or die (mysql_error()); 
        mysql_select_db($DB_Name,$con) or die(mysql_error()); 
    
        $fnumber = mysql_real_escape_string($_GET["fnumber"]);
    
        $result = mysql_query("SELECT * FROM $DB_Table WHERE Something = '$fnumber'", $con);
    
        if ($result) {
            // Check the number of rows in the result set
            if (mysql_num_rows($result) > 0) {
                echo "This user is already in database";
            }
    
            else echo "This user isn't in the database";
        }
    
        mysql_close($con);
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's what I'm trying to accomplish with this program: a recursive method that checks
Here is the css: #content ul { font-size: 12px; } I am trying this:
Here's the flow that I am trying to achieve: 1) User uploads an audio
Here is what I am trying to achieve in PHP: I have this string:
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here's a coding problem for those that like this kind of thing. Let's see
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here is a scenario: User installs .NET application that you have made. After some
Here is what is supposed to happen: The moment the user chooses an option
Here an example of my checkbox list http://jsfiddle.net/YnM2f/ Let's say I check on G

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.