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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:29:45+00:00 2026-06-11T08:29:45+00:00

I cant quite think about how to do this with mysql and php. Basically

  • 0

I cant quite think about how to do this with mysql and php. Basically I want to be able to submit data into a mysql database but before it is inserted, it will check to see if that entry already exists.

$guid=$_POST['guid'];
$name=$_POST['name'];
//Username
$user="webhost";
//Password
$pass="*******";
//IP To Host
$ip="***********";
//Database
$db="dayz2";
//Table
$table="whitelist";

//Database Connection
$con=@mysql_connect("$ip", "$user", "$pass")
            or die(mysql_error());

//Select Database
$dbcon=@mysql_select_db($db, $con)
            or die(mysql_error());
$dupesql = "SELECT * FROM $table where (name = '$name' AND guid = '$guid')";

$duperaw = mysql_query($dupesql);

if (mysql_num_rows($duberaw) > 0) {
  echo "Entry Already Exists";
}
else {
//Query Data Into Whitelist Table
$sql="INSERT INTO $table (name, guid) VALUES ('$name', '$guid')";

//Submit Data into Whitelist Table
$result=@mysql_query($sql, $con) or die(mysql_error());
}
?>
  • 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-06-11T08:29:47+00:00Added an answer on June 11, 2026 at 8:29 am

    You can do it in another way, instead of:

    submit data into a mysql database but before it is inserted, it will
    check to see if that entry already exists.

    You can do:

    INSERT data into a mysql database if not existed, else ignore them

    Something like :

    INSERT IGNORE INTO table
    INSERT IGNORE INTO yourtablename
    SET fieldname = 'blah'
    ,..
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quite experienced but self taught with PHP/MySQL and playing about with Rails. Really love
I can't quite think of how to phrase the question to be precise, but
I have been working on this for some time now and just cant quite
So, I'd like to hear what you all think about this. I have a
I've seen quite a few threads about ClassNotFoundException and Android, but I have yet
I'm having a problem with Fluent NHibernate mappings, I think, and can't quite get
I cant quite get my head around what the ^ is doing in my
I need for Search method for a hashmap and I cant quite figure out
I can't quite figure out why this Linq Statement isn't working as i would
I can't quite wrap my head around this one... A table like the one

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.