Using $stmt = $dbconn->prepare($sql);
$stmt->execute();
Fetch only the first row from the results
$result= $stmt->fetch();

'; echo 'Connected to database
'; /*** The SQL SELECT statement ***/ //$sql = "SELECT * FROM emp1 ORDER BY fname"; $sql= "SELECT ctof(29.25)"; echo" fetch into an PDOStatement object
"; $stmt = $dbconn->prepare($sql); $stmt->execute(); /* Fetch only the first row from the results */ $result= $stmt->fetch(); echo "29.25oC = ".$result[0]." oF "; echo "
db closed "; /*** close the database connection ***/ $dbconn= null; } catch(PDOException $e) { echo $e->getMessage(); } ?>