Webbserverprogrammering 1

Show sourcecode

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

webbsrvprg/webbsrvprg/exercises/PHPDB/ovn1/

createkompisar.php
delete_post_ovn1.php
insert_into_table_ovn1.php
insertintotable_default2.php
post_actions_ovn1.php
selectpost2.php
update_post_ovn1.php

insertintotable_default2.php

30 lines UTF-8 Windows (CRLF)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Namnlöst dokument</title>
</head>

<body>
<?php
include ('../dbconnect.php');
try {
    
$sql = "INSERT INTO kompisar (firstname, lastname, phone, email, reg_date) 
    VALUES ('Allan', 'Mr penis', 0708888888, 'allan.mr.penis@gmail.com', now())"
;
    
// use exec() because no results are returned
    
$dbconn->exec($sql);  
    echo 
"New records created successfully";
}
catch(
PDOException $e)
    {
    echo 
$sql . "<br>" . $e->getMessage();
}

$dbconn = null;

?>
<a href="post_actions_ovn1.php"><button class="link">
            Post actions
    </button></a>
</body>
</html>