Webbserverprogrammering 1

Show sourcecode

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

ramverket/incl/

config.php
connect_db.php
db_handler.php
footer.php
header.php
ovn_incl1.php
ovn_incl2_end.php
ovn_incl2_start.php
ovn_incl3.php
ovn_incl4_end.php
ovn_incl4_start.php

connect_db.php

14 lines ASCII Windows (CRLF)
 <?php
  $servername 
"localhost";
  
$username "root";
  
$password "";

  try {
    
$conn = new PDO("mysql:host=$servername;dbname=mydb"$username$password);
    
// set the PDO error mode to exception
    
$conn->setAttribute(PDO::ATTR_ERRMODEPDO::ERRMODE_EXCEPTION);
  } catch(
PDOException $e) {
    echo 
"Connection failed: " $e->getMessage();
    exit();
  }
?>