chris1056 Posted April 21, 2009 Share Posted April 21, 2009 Okay, So What I Have Now Is This: -Form Code, Works FINE: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Newsletter Readers</title> <style type="text/css"> .off { visibility: hidden; } .on { visibility: visible; } </style> <script type="text/javascript"> window.onload = function() { var timeInterval = 5; if (typeof timeInterval === 'undefined' || parseInt(timeInterval) <= 0) { timeInterval = 1 } document.getElementById('timeinfo').innerHTML = "Please Wait " + timeInterval + " More Seconds." ; var si = setInterval(function() { if (timeInterval === 0) { clearInterval(si); } else { --timeInterval; if (timeInterval !== 0) { document.getElementById('timeinfo').innerHTML = "Please Wait " + timeInterval + " More Seconds."; } else { document.getElementById('timeinfo').className = 'off'; } } }, 1000); setTimeout(function() { document.getElementById('submit').className = 'on'; }, timeInterval * 1000); } </script> </head> <body> <div id="timeinfo"> </div> <br/> <form name="name" action="process.php" method="post"> <label> Last Name: </label> <input type="text" name="lastname" id="lastname" /> <br/> <input type="submit" name="submit" id="submit" value="submit" class="off"/> </form> </body> </html> -Processing Code (Adds data to MySQL Database) <?php $fname=$_POST['lastname']; mysql_connect("localhost", "root", "***********") or die(mysql_error()); mysql_select_db("newsletter") or die(mysql_error()); mysql_query("INSERT INTO `data` VALUES ('$lname')"); Print "Your information has been successfully added to the database."; ?> -What I NEED: After a number of people have added their names, i will have a list of last names that needed to have been entered by those certain people. if they did not add their name, i need to be able to go to a page and Click "Check" to see if they went to my website and added their name. So summing it up/example: List of ppl who went to site + entered name: -Joe -Craig -Devin -Liz List of who was supposed to add their name: -Joe -Craig -Devin -Liz -Jordan -Miles When i go to /check.php Shows those who didn't go to site.: -Jordan -Miles I Hope You Understand. Quote Link to comment https://forums.phpfreaks.com/topic/154975-help-with-comparing-lists/ Share on other sites More sharing options...
mandred Posted April 21, 2009 Share Posted April 21, 2009 mysql_query("SELECT * FROM data WHERE field='$lname'"); Quote Link to comment https://forums.phpfreaks.com/topic/154975-help-with-comparing-lists/#findComment-815202 Share on other sites More sharing options...
chris1056 Posted April 21, 2009 Author Share Posted April 21, 2009 So, Lets Pretend I was SUPER new with php coding... Quote Link to comment https://forums.phpfreaks.com/topic/154975-help-with-comparing-lists/#findComment-815951 Share on other sites More sharing options...
chris1056 Posted April 21, 2009 Author Share Posted April 21, 2009 Sry, I Couldnt Find The Edit Button :/ Okay so That Code mysql_query("SELECT * FROM data WHERE field='$lname'"); Only Shows The Data. I Need To have it compare 2 separate lists of data (See First post) Quote Link to comment https://forums.phpfreaks.com/topic/154975-help-with-comparing-lists/#findComment-815989 Share on other sites More sharing options...
fenway Posted April 22, 2009 Share Posted April 22, 2009 If you had both "lists" in a table, the comparison would be trivial. Quote Link to comment https://forums.phpfreaks.com/topic/154975-help-with-comparing-lists/#findComment-816386 Share on other sites More sharing options...
chris1056 Posted April 22, 2009 Author Share Posted April 22, 2009 LOL, when I have to check who did, it has to be quick. I have like 2 minutes. A script would make my Tuesdays 100x easier. Quote Link to comment https://forums.phpfreaks.com/topic/154975-help-with-comparing-lists/#findComment-816917 Share on other sites More sharing options...
kickstart Posted April 23, 2009 Share Posted April 23, 2009 Hi Presuming you can have each list in a table like:- EnteredTable Id, Name 1,Joe 2,Craig 3,Devin 4,Liz ExpectectedTable Id, Name 1,Joe 2,Craig 3,Devin 4,Liz 5,Jordan 6,Miles Simple way to do it (not that efficient but easy to understand) SELECT * FROM ExpectectedTable WHERE Id NOT IN (SELECT Id FROM EnteredTable) Probably better:- SELECT * FROM ExpectectedTable a LEFT OUTER JOIN EnteredTable b ON a.Id = b.Id WHERE b.Id IS NULL All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/154975-help-with-comparing-lists/#findComment-817202 Share on other sites More sharing options...
chris1056 Posted April 23, 2009 Author Share Posted April 23, 2009 Thanks, Ill Try These When I Get Home! I Appreciate All the Help! Quote Link to comment https://forums.phpfreaks.com/topic/154975-help-with-comparing-lists/#findComment-817399 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.