setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}
?>
test
prepare($sql);
$stmt->bindParam(':name', $_POST['name'], PDO::PARAM_STR);
$stmt->bindParam(':gebdat', $_POST['gebdat'], PDO::PARAM_STR);
$stmt->execute();
}
if (isset($_POST['fetch'])) {
$count = 0;
if ($_POST['name'] == null) {
$count = 1;
}
$sql = "SELECT * FROM user";
$stmt = $db->prepare($sql);
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo "{$row['u_id']} {$row['u_name']} {$row['u_gebdat']}
";
}
foreach ($_POST['tables'] as $key) {
echo $key;
}
}
?>