Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbserverprogrammering/exercises/mysqlintro/kompisar/

createtable.php
dbconnection.php
deletepost.php
deletetable.php
index.html
insertdefaultposts.php
insertpost.php
selectposts.php
updatepost.php

deletetable.php

31 lines ASCII Windows (CRLF)
<!-- deletetable.php -->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Deletetable</title>
</head>

<body>
<?php
include ('dbconnection.php');
try {

    
// sql to delete table
    
$sql "DROP TABLE IF EXISTS pdodemotable";
    
//use exec() because no results are returned
    
$dbconn->exec($sql);
    echo 
"Table deleted successfully";
}
catch(
PDOException $e)
    {
    echo 
$sql "<br>" $e->getMessage();
}

//Rensa kopplingen till databasen
$dbconn null;

?>
<button onclick="window.location.href='index.html'">Meny</button>
</body>
</html>