1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Delete Duplicate Entries In MySql with PHP

I needed to delete duplicate entries in MySql with PHP. After some trial and error I wrote a script that will do it for me. What I needed to do was delete duplicate email addresses in a email script. Here is the code that made that magic happen.


Tip: Click on images to make them larger. If you find anything wrong on this page or need further assistance please comment below or contact me. 🙂
 $result = $con->query("SELECT email FROM newsusers group by email having count(*) >= 2") ;
while ($row = $result->fetch_assoc()) {
    echo $orgemail;
    echo '<br/>';
mysqli_query($con,"DELETE FROM newsusers WHERE email='$orgemail' ");
Delete Duplicate Entries In MySql with PHP was last modified: August 5th, 2016 by Maximus Mccullough

Subscribe To My YouTube Channel:

Please like, share and subscribe.

Advanced Programming Made Easy

I hope you enjoyed the article. If I was able to help you please consider a tip for the content.

One Time Tip

more tips

Reoccuring Tips


Cool People Share:
PHP Web Development

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.