I converted the following working code:
<?php
include('config.php');
$link = mysql_connect($db_host, $username, $password);
mysql_select_db($db_name);
$id= $_POST["uniqi"];
$comments= $_POST["comments"];
$comments= mysql_real_escape_string($comments);
$comments = strip_tags($comments);
$update = "UPDATE mastertable SET comments = '$comments' WHERE id_pk= '$id'";
mysql_query($update, $link);
mysql_close();
header('Location: ccccc.com/pabrowser/… Updated');
?>
to PDO:
<?php
$id= $_POST["uniqi"];
$comments= $_POST["comments"];
$conn = new PDO("mysql:host=$db_host;dbname=$db_name", $username, $password);
$sql = "UPDATE mastertable SET comments=? WHERE id_pk=?";
$q = $conn->prepare($sql);
$q->execute(array($comments, $id));
header('Location: ccccc.com/pabrowser/… Updated');
?>
Which gave me
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' in /home/content/58/9508458/html/pabrowser/comsumcompro.php:4 Stack trace: #0 /home/content/58/9508458/html/pabrowser/comsumcompro.php(4): PDO->__construct('mysql:host=;dbn...', NULL, NULL) #1 {main} thrown in /home/content/58/9508458/html/pabrowser/comsumcompro.php on line 4