Webbserverprogrammering 1

Show sourcecode

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

webbsrvprg/exercise/

exercise/
hi.php
include_1.php
include_2a.php
include_2b.php
include_2c.php
include_lib.php
index.php
ovn_cookie-session1.php
ovn_cookie-session2.php
ovn_cookie-session3.php
ovn_cookie-session3a.php
ovn_cookie-session4.php
ovn_form1.php
ovn_form1a.php
ovn_form2.php
ovn_form2a.php
ovn_form3.php
ovn_form3a.php
ovn_form4.php
ovn_form4a.php
ovn_form5.php
ovn_form5a.php
ovn_form6.php
ovn_form6a.php
ovn_form7.php
ovn_form7a.php
ovn_ft1.php
ovn_ft1a.php
ovn_ft2.php
ovn_ft3.php
ovn_ft4.php
ovn_ft5.php
ovn_ft6.php
ovn_funk1.php
ovn_funk2.php
ovn_funk3.php
ovn_funk4.php
ovn_funk5.php
ovn_funk6.php
ovn_funk7.php
ovn_funk8.php
ovn_funk9.php
ovn_gr1.php
ovn_gr2.php
ovn_gr3.php
ovn_gr4.php
ovn_gr5.php
ovn_gr6.php
ovn_klass1.php
ovn_klass2.php
ovn_klass3.php
ovn_klass4.php
ovn_klass5.php
ovn_klass6.php
ovn_klass7.php
ovn_ms1.php
ovn_ms1a.php
ovn_ms1b.php
ovn_ms1c.php
ovn_ms2.php
ovn_ms2a.php
ovn_ms2b.php
ovn_ms2c.php
ovn_ms3.php
ovn_ms3create.php
ovn_ms3init.php
ovn_ms3insert.php
ovn_ms3view.php
ovn_rep1.php
ovn_rep2.php
ovn_rep3.php
ovn_rep3a.php
ovn_str1.php
ovn_str1a.php
ovn_str2.php
ovn_str2a.php
ovn_str3.php
ovn_str3a.php
ovn_str4.php
ovn_str4a.php
ovn_str5.php
ovn_str5a.php
ovn_str6.php
ovn_str6a.php
testFramework.php

ovn_ms3view.php

81 lines UTF-8 Windows (CRLF)
<?php
require ('../incl/dbconnection.php');

$sql "SELECT * FROM garage";
    
$stmt $dbconn->prepare($sql);
    
$res $stmt->fetchAll();
    
$stmt->execute();
    
$output "<table><caption>Garage</caption>";
    while (
$res $stmt->fetch(PDO::FETCH_ASSOC)) {
        
$output .= "<tr>".
            
"<td>".htmlentities($res['garageid'])."</td>".
            
"<td>".htmlentities($res['namn'])."</td></tr>";
    }
    
$output .= "</table>";
    echo 
"$output <br>";

    
$sql "SELECT * FROM owners";
    
$stmt $dbconn->prepare($sql);
    
$res $stmt->fetchAll();
    
$stmt->execute();
    
$output "<table><caption>Ägare</caption>";
    while (
$res $stmt->fetch(PDO::FETCH_ASSOC)) {
        
$output .= "<tr>".
            
"<td>".htmlentities($res['ownerid'])."</td>".
            
"<td>".htmlentities($res['namn'])."</td></tr>";
    }
    
$output .= "</table>";
    echo 
"$output <br>";

    
$sql "SELECT * FROM car";
    
$stmt $dbconn->prepare($sql);
    
$res $stmt->fetchAll();
    
$stmt->execute();
    
$output "<table><caption>Bilar</caption>";
    while (
$res $stmt->fetch(PDO::FETCH_ASSOC)) {
        
$output .= "<tr>".
            
"<td>".htmlentities($res['carid'])."</td>".
            
"<td>".htmlentities($res['regnr'])."</td>".
            
"<td>".htmlentities($res['color'])."</td>".
            
"<td>".htmlentities($res['cargarage'])."</td>".
            
"<td>".htmlentities($res['carowner'])."</td>"."</tr>";
    }


    

    
$output .= "</table><br><br>";
    echo 
"$output";

    
$sql ="SELECT c.carid, c.regnr, c.color, g.namn AS gnamn, o.namn AS onamn FROM car AS c INNER JOIN garage  AS g ON c.cargarage=g.garageid INNER JOIN owners AS o ON c.carowner=o.ownerid ORDER BY g.namn ASC, o.namn ASC";
    
$stmt $dbconn->prepare($sql);
    
$res $stmt->fetchAll();
    
$stmt->execute();
    
$output "<table><td>id</td><td>regnr</td><td>färg</td><td>garage</td><td>ägare</td>";
    while (
$res $stmt->fetch(PDO::FETCH_ASSOC)) {
        
$output .= "<tr>".
            
"<td>".htmlentities($res['carid'])."</td>".
            
"<td>".htmlentities($res['regnr'])."</td>".
            
"<td>".htmlentities($res['color'])."</td>".
            
"<td>".htmlentities($res['gnamn'])."</td>".
            
"<td>".htmlentities($res['onamn'])."</td>"."</tr>";
    }
    
$output .= "</table>";
    echo 
"$output";

?>


<style>

    table{
        border: 1px red solid;
    }

    td{
        border:1px red dotted;
        border-left:1px red solid;
        border-right:1px red solid;
    }

</style>