Make the row you want unique and then this code should do
$query = "INSERT IGNORE INTO blocks (pagename) VALUES ('$pagetitle')"; mysql_query($query) or die(mysql_error());