You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
355 B
PHTML

<?php
function getRecord($pdo, $from, $where ){
$conn = $pdo;
try {
$sql = "SELECT * FROM $from WHERE id = $where";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
$record = $stmt->fetch();
} catch (PDOException $e) {
echo "Error in $from: Not Found";
}
return $record;
}