Show sourcecode
The following files exists in this folder. Click to view.
webbsrvprg/exercises/ajax/extra1/
createtable.php
delete.php
extra1.php
select.php
service.php
signIn.php
service.php
34 lines UTF-8 Windows (CRLF)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php
if (isset($_GET["name"])) {
/** @var PDO $dbconn */
include "../../../dbconnection.php";
try {
$sql = "SELECT * FROM ajaxextra1 WHERE username=?";
$stmt = $dbconn->prepare($sql);
$data = array($_GET["name"]);
$stmt->execute($data);
if ($stmt->fetch(PDO::FETCH_ASSOC)) {
echo "Användarnamnet är upptaget";
} else {
echo "Ok!";
}
}
catch (PDOException $e) {
echo $e;
}
}
?>
</body>
</html>