<?php

include_once 'moduleLijst.php';
?>
<!DOCTYPE HTML> 
<html> 
    <head> 
        <meta charset=utf-8> 
        <title>gegevensOphalen</title> 
    </head>
<body> 
    <h1>Resultaat</h1>
      <?php 
$pl = new ModuleLijst();
$tab = $pl->getLijst();
?>
 
        <ul> 
            <?php 
foreach ($tab as $module) {
    print "<li>" . $module . "</li>";
}
?>
 
            </ul>
</body> 
</html>

            $module = new Module($rij["id"], $rij["naam"], $rij["prijs"]);
            array_push($lijst, $module);
        }
        $dbh = null;
        return $lijst;
    }
    public function deleteModule($id)
    {
        $sql = "delete from modules where id = :id";
        $dbh = new PDO("mysql:host=localhost;dbname=cursusphp;charset=utf8", "cursusgebruiker", "cursuspwd");
        $stmt = $dbh->prepare($sql);
        $stmt->execute(array(':id' => $id));
        $dbh = null;
    }
}
$modLijst = new ModuleLijst();
if (isset($_GET["action"]) && $_GET["action"] == "verwijder") {
    $modLijst->deleteModule($_GET["id"]);
}
?>


<!DOCTYPE HTML>
<html>
	<head>
		<meta charset=utf-8>
		<title>Modules</title>
	</head>
	<body>
		<h1>Modules</h1>
		<?php 
예제 #3
0
    $updated = true;
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset=utf-8>
<title>Modules</title>
</head>
<body>
	<h1>Module bewerken</h1>
	<?php 
if ($updated) {
    print "Record bijgewerkt!";
}
$ml = new ModuleLijst();
$module = $ml->getModuleById($_GET["id"]);
?>
	<form action="modulebewerking.php?action=verwerk&id=<?php 
print $_GET["id"];
?>
" method="post">
		Naam:
		<input type="text" name="naam" value="<?php 
print $module->getNaam();
?>
"><br><br>
		Prijs:
		<input type="text" name="prijs" value="<?php 
print $module->getPrijs();
?>
class ModuleLijst
{
    public function createModule($naam, $prijs)
    {
        $sql = "insert into modules (naam, prijs) values (:naam, :prijs)";
        $dbh = new PDO("mysql:host=localhost;dbname=cursusphp;charset=utf8", "cursusgebruiker", "cursuspwd");
        $stmt = $dbh->prepare($sql);
        $stmt->execute(array(':naam' => $naam, ':prijs' => $prijs));
        $laatsteID = $dbh->lastInsertId();
        print $laatsteID;
        $dbh = null;
    }
}
?>


<!DOCTYPE HTML>
<html>
	<head>
		<meta charset=utf-8>
		<title>Modules</title>
	</head>
	<body>
		<h1>Module toevoegen</h1>
		<?php 
$mlijst = new ModuleLijst();
$mlijst->createModule("Access", 85.0);
?>
	</body>
</html>
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title>resultaat Form modules opzoeken</title>
    </head>
    <body>
        <h1>Zoekresultaat</h1>
		<?php 
$min = $_POST["minimum"];
$max = $_POST["maximum"];
//echo $min, " ",  $max;
$pl = new ModuleLijst();
$tab = $pl->getLijst($min, $max);
//$bat = $pl->getLijst($max);
//$tab = $pl->getLijst('Peeters','V');
?>
		<ul>
			<?php 
foreach ($tab as $naam) {
    print "<li>" . $naam . "</li>";
}
//foreach ($bat as $maan) {
//	print("<li>" . $maan . "</li>");
//}
?>
		</ul>
    </body>
?>


<!DOCTYPE HTML>
<html>
	<head>
		<meta charset=utf-8>
		<title>Modules</title>
	</head>
	<body>
		<h1>Module bewerken</h1>
		<?php 
if ($updated) {
    print "Record bijgewerkt!";
}
$modLijst = new ModuleLijst();
$module = $modLijst->getModuleById($_GET["id"]);
?>
		<form action="dbGegevensBewerken.php?action=verwerk&id=  
			<?php 
print $_GET["id"];
?>
" method="post">
			Naam: <input type="text" name="naam" value="  
				<?php 
print $module->getNaam();
?>
" /><br /><br />
			Prijs: 	<input type="text" name="prijs" value="  
				<?php 
print $module->getPrijs();
//overzicht.php
require_once "ModuleLijst.php";
?>


<!DOCTYPE HTML>
<html>
	<head>
		<meta charset=utf-8>
		<title>Modules</title>
	</head>
	<body>
		<h1>Modules</h1>
		<?php 
$modLijst = new ModuleLijst();
$tab = $modLijst->getLijst();
?>
		<ul>
			<?php 
foreach ($tab as $module) {
    $moduleNaam = $module->getNaam();
    $moduleId = $module->getId();
    $modulePrijs = $module->getPrijs();
    print "<li>" . $moduleNaam . " (" . $modulePrijs . " euro)   \n\t\t\t\t\t(<a href=\"dbGegevensBewerken.php?id=" . $moduleId . "\"> --> Bewerken</a>) </li>";
}
?>
		</ul>
		
	</body>
</html>