Dear intekhab,
Thanks for these valuable information. With thanks, Leelakh Ran. _____ From: php_mysql@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of intekhab rizvi Sent: Monday, January 21, 2008 6:36 PM To: php_mysql@yahoogroups.com Subject: Re: [php_mysql] How can avoid duplicate entry Hi Leelakh, Here is your answer. For no 1 <?php $connection = @mysql_connect("localhost" , "user_id" , "password") or die ("Unable To Connect To The Database"); $db_name = "database name"; $db_table = "table name"; $db = @mysql_select_db($db_name , $connection) or die ("Unable To Select Database"); $chk_query = mysql_query("SELECT * FROM $db_table WHERE tname = '$_POST[name]' AND taddress = '$_POST[address]' AND tcity = '$_POST[city]'", $connection ) or die (mysql_error()); if (mysql_affected_rows() > '0') { echo "Sorry Already Have Infomation"; } else { //here type your database insert query } ?> For no 2 //pls insert this script on your form page <?php session_start(); $_SESSION['security_no'] = rand(); echo $_SESSION['security_no']; ?> after copying this make new fileld with name what ever you want. //pls insert this script on the page where your databases insert query is working or form submition page. <?php session_start(); if ($_POST['insert new created fileld name here'] == $_SESSION['security_no']) { enter here the database insert query } else { echo "pls re-enter the code"; } ?> Cheers Leelakh Ran <[EMAIL PROTECTED] <mailto:ran%40a2ztown.com> com> wrote: Dear members, I have one form to accept name, address and city of the user. Sometimes some users sending same data several times. So I want to solve this peoblem by following two ways. 1) comparing input data with database table. It is the fields tname, taddress and tcity from table1 on db1 mysql database. If the user inputs name+address+city = tname+taddress+tcity, it should not accept. How I can write code for this comparison. 2) I want to check inputs by a security code. If each time form loads the sucurity code should be different and if the user not feeding the code correctly, form feedbacks should not accept. How it can do? If you can give answers for any of these query, it will be highly appreceable. With thanks and regards, Leelakh Ran. [Non-text portions of this message have been removed] --------------------------------- Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]