im trying to remove some duplicate entries from my db with this
<?
require ("db.php");
$result = mysql_query("select * from attractions");
while($row = mysql_fetch_assoc($result)) {
extract($row);
mysql_query("delete from attractions where aname='$aname' AND attractionID<>'$attractionID'") or die (mysql_error());
}
?>
but in some of the aname there are (') so i get an error like below and have to manually delete the ' from the name in the database untill i hit the next one.
You have an error in your SQL syntax near 's Cider Farm Centre.' AND attractionID<>'261'' at line 1
any help appreciated!