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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:57:57+00:00 2026-05-27T22:57:57+00:00

I made a small database(1 table) in phpMyAdmin. One of the fields I want

  • 0

I made a small database(1 table) in phpMyAdmin. One of the fields I want to check is “Name”.
I want to verify through PHP if a name that user types in a form exists in the database. In the html a list of names from DB appears, but the user might type wrong the name in the form.
The problem is the answer whether it exists or not varies.

I have 2 PHP files:
Connection.php and welcome.php

Connection

 <html> 
 <head>
 <title>Project</title>
 </head>
 <body>

 <?php
 mysql_connect("localhost","root","");
 mysql_select_db("e-card");

 $sql=mysql_query("SELECT * FROM person");
 $dbname="name";
 #$formula_adr="formula_adr";
 #$adress="adr";
 $line=mysql_fetch_assoc($sql);

 echo'Choose a name to whom you send e-card:<br/><br/>';
 echo $line[$dbname].'<br/>';
 while($line=mysql_fetch_assoc($sql))
 echo $line[$dbname].'<br/>';
 ?>
 <form action="welcome.php" method="POST">
 Nume: <input type="text" name="fname" />
 <input type="submit" value="Verify existance in DB"/>
 </form>    
 </body>
 </html>

And welcome:

 <?php
 mysql_connect("localhost","root","");
 mysql_select_db("e-card");

 $sql=mysql_query("SELECT * FROM persoana");
 $dbname="name";
 $formula_adr="formula_adr";
 $adresa="adr";
 $linie=mysql_fetch_assoc($sql);

 if ($_SERVER['REQUEST_METHOD']=='POST' and isset($_POST['fname']))
 {
 $name = $_POST['fname'];

 while($line=mysql_fetch_assoc($sql))
 {
 if(strcmp($name,$line[$dbname]))
 {
 echo 'Found';
 }
 else
 {
 echo 'This name doesn't exist in DB';
 }
 }
 }
 ?>

THANK YOU 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-27T22:57:57+00:00Added an answer on May 27, 2026 at 10:57 pm

    I would follow these steps high level steps.

    1 – use javascript to initially check on client side that something was entered BEFORE calling the DB. You can use a filter in your javascript to check that form field.

    2 – If you verify that something *useful was entered – pass the form field value to another page or object that will parse the value and then query the table.

    3 – Use the parsed value against the db table column that contains your data. If records are found, return them.

    Use a SQL injection technique to prevent malicious intend by users who may type something evil into your form field.

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

Sidebar

Related Questions

I have made a small log service that i want to publish to a
I have a database in production with one table that has grown extremely large
Post-release, I have made one small change to one form in our development site
I have a small ruby application that I made on my local machine. It
I have a PHP website backed by a MySQL database and a small team
I want to connect a table that i have created in SQL Developer to
I've made database design for a small CRM system. It comprises of Companies and
I have a database table which holds each user's checkins in cities. I need
I am a PHP newbie, but I'm making progress. I have made a small
I made small program to divide large pictures and take part of them. 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.