jdintexas Posted January 17, 2011 Share Posted January 17, 2011 Pehaps this is kidstuff but i'm a kid at heart. I have only 1 form field on a form User enters a special code in the form. Once submitted the form is queried against a mysql database to see if the code exists. If code does not exist it must be reentered. If code exists then redirected. basically its like "get to the next page if you have the code" thanks Quote Link to comment https://forums.phpfreaks.com/topic/224753-just-need-to-check-if-a-record-exists-in-one-field/ Share on other sites More sharing options...
Rifts Posted January 17, 2011 Share Posted January 17, 2011 so what part of that have you finished and where are you stuck? Quote Link to comment https://forums.phpfreaks.com/topic/224753-just-need-to-check-if-a-record-exists-in-one-field/#findComment-1160924 Share on other sites More sharing options...
Maq Posted January 17, 2011 Share Posted January 17, 2011 Yes, we need more information and what you are actually stuck on. If you need to do the entire thing we can tell you HOW to do it and point you in the right direction. Pehaps this is kidstuff but i'm a kid at heart. What is kidstuff? Quote Link to comment https://forums.phpfreaks.com/topic/224753-just-need-to-check-if-a-record-exists-in-one-field/#findComment-1160927 Share on other sites More sharing options...
Rifts Posted January 17, 2011 Share Posted January 17, 2011 kidstuff == kids stuff as in its very easy Quote Link to comment https://forums.phpfreaks.com/topic/224753-just-need-to-check-if-a-record-exists-in-one-field/#findComment-1161007 Share on other sites More sharing options...
Maq Posted January 17, 2011 Share Posted January 17, 2011 kidstuff == kids stuff as in its very easy Gotcha, I took it another way... Quote Link to comment https://forums.phpfreaks.com/topic/224753-just-need-to-check-if-a-record-exists-in-one-field/#findComment-1161009 Share on other sites More sharing options...
jdintexas Posted January 17, 2011 Author Share Posted January 17, 2011 yeah. i'm an old cold fusion programmer and my php skills are rusty to non existence. just need to be directed to the right place. "kids stuff" meaning easy on a php level but obviously not to me. sorry if seemed offensive. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/224753-just-need-to-check-if-a-record-exists-in-one-field/#findComment-1161046 Share on other sites More sharing options...
Maq Posted January 17, 2011 Share Posted January 17, 2011 yeah. i'm an old cold fusion programmer and my php skills are rusty to non existence. just need to be directed to the right place. "kids stuff" meaning easy on a php level but obviously not to me. sorry if seemed offensive. thanks. No, I did not take offense to it, just misinterpretation on my part (but thanks for clarifying). Try something like this (sorry haven't tested it): if(isset($_POST['submit'])) { $code = mysql_real_escape_string($_POST['code']); $query = "SELECT * from [table][tr][td] WHERE code = '$code'"; $result = mysql_query($query) or die(mysql_error()); if($mysql_num_rows($result) > 0) { echo "Code already exists"; } else { echo "Code is free"; } } ?> </pre> <form action="" method="POST"> < [/td][/tr][/table] Quote Link to comment https://forums.phpfreaks.com/topic/224753-just-need-to-check-if-a-record-exists-in-one-field/#findComment-1161051 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.