dan_t Posted May 2, 2010 Share Posted May 2, 2010 I have this simple form echo <<<EOF <form action="log_user.php" method="post"> Please enter User Id: <input type="text" name="in_userId"> <input type="submit" name="sub_use" value="send"> </form> EOF; and I have this simple run through an array from a database $in_userId = $_POST['in_userId']; //select user info $users_result = "select userId from persinfo where cat_id =1"; $user_result = mysql_query($users_result); while($row = mysql_fetch_array($user_result)) { print($row['userId']).'<br>'; } How can I check this input against a user in the database? I can't seem to get anything to work. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 2, 2010 Share Posted May 2, 2010 Why not check in the SQL? $users_result = sprintf("SELECT userId FROM persinfo WHERE cat_id = 1 AND userId = '%s';", mysql_real_escape_string($in_userId)); Quote Link to comment 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.