I am doing email adding program into my database..! in that some code" <?php $email=$_POST['email']; $datetime=date("d/m/y h:i:s"); //create date time $status1 = "OK"; $msg1=""; if(strlen($email) <=0){ $msg1=$msg1."E-mail/E-mail Row You Entered Should Not Be Empty <br> Make sure that there is no spaces <br><br>"; $status1 = "NOTOK";} if($status1<>"OK") { echo "<font face='Verdana' size='2' color=red>$msg1</font>"; } if($status1 == "OK") { $email_addresses = "$email"; $sql = "insert into $tbl_name (email) values('". join("'), ('", preg_split('/\s*,\s*/', $email_addresses)). "')"; // $sql="INSERT INTO $tbl_name(email)VALUES('$email')"; $result=mysql_query($sql); } if($result){ ?> PHP: This will adds multiple emails with comma, so yester day i tried to add 186 emails at a time.. alll are added but my problem is of which some are already there.. What i need is: when i press add, in my form it must check the email is there in the database and separate those and echo them... Example: i mean.., i need to print out of 186, let 56 mails are add and 130 are duplicate message with the mails too Hope you understand please help me.. thanksssssssssssssssssss a lottt.!
You might find the "on duplicate" option useful http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html however if it seems advanced I'd just explode the string of emails, work through them one by and check to see if they have already been added. Depending on the size of your list you may be better to query over and over, or get the lot into an array and check the array.
ya i think better to check by taking into array..! i will try. Still any body have better idea.....!, when i click on submit button with 200 emails, the corresponding page will.... $email=$_POST['email']; hear as i submitt 200 emails.. echo "$email"; This will prints email1, email2, email3, email4, email5....................email199,email200. But how can i take into array one by one.., any body please give me as a simple script lines.. not just like comments.. PHP: Thanks for your replies friends..! ---------------------------------------------------------------------------------------------- And $c = join("'), ('", preg_split('/\s*,\s*/', $email)); PHP: this above line printing..., email1'),('email2'),('email3'),('email4'),('email5'),('email6'),..................('email200'), how can i take them in to array so that i can check easily...,