0

I have a table with the following fields:

id
project
projectName

There are two different way when I display this data:

  1. Before I store it into a database I place projectName values into text fields. In this case I need to be able to somehow mark when there are duplicated with some sort of jQuery code, and \

  2. I output the values from db into a list. Again, I need to somehow catch duplicates and mark them somehow, perhaps changing text color.

There could be multiple duplicate sets.

How can I do that?

1
  • a little more detail on workflow would sure help..from beginning of table creation to update process, no way to tell what is being done where from loose description Commented Mar 7, 2012 at 2:51

1 Answer 1

1

Ok, you can send an ajax request to the server and see if is actually duplicate. I will give a simple example of how we can get something like this to work.

HTML

<a id="check"> check availabilty</a>

JQuery

$("#check").click(function() {
    $.post("checkname.php", 
           { name : $("#textboxname").val() },
           function(data) {
             //data will contain the output from the file `checkname.php`
             if(data=="ok") { //imagine the case it output ok if not duplicate is found
                alert('ok');
             else { 
                alert('duplicate name exists');
             }
    );
});

PHP checkname.php

$name = $_POST['name'];
//now confirm this with a query or just use your own logic
//
//

if($resultfound) { echo "ok"; } else { echo "no"; }

Note: This is a very basic example to illustrate the process.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.