MySql help - need to prevent the duplication of information when inserting to DB
Posted 03 August 2006 - 07:05 AM
Im am doing the web-based application, where I have to add some information from front-end, and then add it to the database. Now, I would like to get the MySQL statement that will prevent me from adding same thing in 1 table.
Please help me, I need to do this by end of today.
Posted 03 August 2006 - 08:46 AM
first identify those fields and just write a select query .
$sql="select count(*) as cnt from tablename where email!='".$_REQUEST['email']."'";
//you can add if you need to check another fields too like $sql." and fname!='".$_REQUEST['fname']."'";
//here insert statement
//email already exists error message
//same form with $_REQUEST fields filled
Posted 03 August 2006 - 12:35 PM
its working right now, thank you very much. I took ur advise.
thanks a million.
Posted 03 August 2006 - 02:27 PM
Posted 04 August 2006 - 04:57 AM
You have given good suggestions for me.
I am very much thankful to you.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users