Παράδειγμα δήλωσης PDO
6
1.
$dbconn= new PDO("mysql:host=$dbhost;dbname=$dbase", $dbuser, $dbpass);
2.
$test = $_GET['tid'];
3.
$current_datetime = date('Y-m-d H:i:s');
4.
$query = $dbconn->prepare("SELECT * FROM tests WHERE id= :tid AND start_date<=
:cdate");
5.
$query->bindParam(':tid', $test);
6.
$query->bindParam(':cdate', $current_datetime);
7.
$query->execute();
8.
$rows = $query->fetch(PDO::FETCH_ASSOC);