leeroy1 Posted October 6, 2004 Share Posted October 6, 2004 Is it possible to execute a sql statement or something in order to check if a field a user has enter already exists in a table, and if it does tells the user and does not try to submit the form? Or is there a better way to do this? Quote Link to comment https://forums.phpfreaks.com/topic/1983-checking-for-duplicates/ Share on other sites More sharing options...
x_ash Posted October 7, 2004 Share Posted October 7, 2004 i think mysql statement can already detect if a certain user enters a field that already exists. I has a prompt saying "Duplicate entry" on it. If u want it more formal, you may add message box on it using javascript. hope this help Quote Link to comment https://forums.phpfreaks.com/topic/1983-checking-for-duplicates/#findComment-6504 Share on other sites More sharing options...
jerry187 Posted October 7, 2004 Share Posted October 7, 2004 Do you mean looking for a value and telling the user if it already exists? $result = mysql_query("SELECT column_name FROM tbl_name WHERE column_name='$value'"); if (!mysql_num_rows($result > 0) { // code here } Quote Link to comment https://forums.phpfreaks.com/topic/1983-checking-for-duplicates/#findComment-6505 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.