Skip to content

Instantly share code, notes, and snippets.

@BMU-Verlag
Last active September 12, 2020 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BMU-Verlag/032831f896f54a0a0187c5bdc8246c5c to your computer and use it in GitHub Desktop.
Save BMU-Verlag/032831f896f54a0a0187c5bdc8246c5c to your computer and use it in GitHub Desktop.
<?php
$sql = "SELECT co_date FROM os_complaints WHERE co_id = 1;";
try
{
$dbh = new PDO ("mysql:dbname=onlineshopDB; host=localhost", "user1", "abc");
$return = $dbh->query($sql);
$result = $return->fetchAll(PDO::FETCH_ASSOC);
print "Complaint date:". $result[0]['r_datum'] ."<br>\n";
$error = $dbh->errorInfo();
if ($error[0] > 0)
{
print "Error Code: " .$error[1]."<br>".$error[2];
}
$dbh = null;
}
catch(PDOException $e)
{
print $e->getMessage();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment