I have a little problem, my table 'furniture' contains records where the ID is the same. I'll show you.
Title
id : public_name
1 : 'desk'
1 : 'desk'
1 : 'desk'
2 : 'comp'
2 : 'comp'
3 : 'rug'
3 : 'rug'
3 : 'rug'
3 : 'rug'
I don't know how it happened, but the record for id 2 has been duplicated, and some of them has even been tripled. I've tried this script to solve it.
<?php
$con = mysql_connect("localhost","root","pass");
Mysql_Select_db("db", $con);
for($i = 0; $i < 52752; $i++) {
$find = mysql_query("SELECT * FROM furniture WHERE id = '".$i."'");
$count = mysql_num_rows($find);
mysql_query("DELETE FROM furniture WHERE id = '$i' LIMIT ($i - $count)");
echo "'.$i.' fixed";
}
But it is not working, it deletes all off the ids, I want it to leave one record per id.
Is there any easy query or script to solve this?