How do I turn this code into a code that works with PDO?
if($_POST['name']=='home_title'){
$id=$_POST['pk'];
$home_title=$_POST['value'];
$result=mysql_query("SELECT COUNT(*) as count FROM sw_configuration WHERE id=$id") or die(mysql_error());
$count= mysql_fetch_row($result);
if($count[0]==0){
mysql_query("INSERT INTO sw_configuration(id,home_title) VALUES('".$id."','".$home_title."')") or die(mysql_error());
}else{
mysql_query("UPDATE sw_configuration SET home_title='".$home_title."' WHERE id=$id") or die(mysql_error());
}
}