emailconfirmed, nsInternRO, nsInternRW, Administrators
3,356
edits
mNo edit summary |
(frontend) |
||
Line 121: | Line 121: | ||
</HTML> | </HTML> | ||
</source> | |||
=== 3. Das Frontend === | |||
...ist im Prinzip das Gleiche wie das Backend, nur sehr viel einfacher, da wir uns nicht darum kümmern müssen, die Werte zu aktualisieren. Außerdem kann man davon ausgehen, dass alle Tabellen und die Datenbank bereits exisitieren | |||
''Datei frontend.php:'' | |||
<source lang="PHP"> | |||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |||
<HTML> | |||
<head> | |||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |||
<title>MySQL Example</title> | |||
</head> | |||
<body> | |||
<?PHP | |||
// connect to db | |||
include("config_db.php"); | |||
// select db | |||
mysql_select_db($db_name, $link); | |||
?> | |||
<table width="90%" align="center" valign="top"> | |||
<?php | |||
$result = mysql_query("SELECT * FROM products"); | |||
$i = 0; | |||
while($entry = mysql_fetch_array($result, MYSQL_BOTH)) { | |||
printf("<tr> | |||
<td>%s</td> | |||
<td>%01.2f €</td> | |||
</tr>", | |||
$entry[prodName], | |||
$entry[prodPrice] ); | |||
$i++; | |||
} | |||
?> | |||
</table> | |||
</body> | |||
</HTML> | |||
</source> | </source> | ||