Echo-en vanuit database
Ik ben vandaag begonnen met het proberen om een simpel cmsje te bouwen... Ik heb nu al een gedeelte gemaakt dat info uit een database haalt.
Te zien op: http://www.bjorncouwenberg.nl/carnaval2009/test/cms/index.php
maar deze laat alles uit de tabel zien.. Ik wil dat hij bijvoorbeeld alleen ID 1 (met als titel home) laat zien.. Hoe doe ik dit??
Script:
Te zien op: http://www.bjorncouwenberg.nl/carnaval2009/test/cms/index.php
maar deze laat alles uit de tabel zien.. Ik wil dat hij bijvoorbeeld alleen ID 1 (met als titel home) laat zien.. Hoe doe ik dit??
Script:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
$con = mysql_connect("SERVER","USER","PASSWORD");
if (!$con)
{
die('Kon geen verbinding maken... Error: ' . mysql_error());
}
mysql_select_db("DATABASE", $con);
$result = mysql_query("SELECT * FROM AlgemeneTeksten");
echo "<table border='1'>
<tr>
<th>ID</th>
<th>Titel</th>
<th>Content</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['ID'] . "</td>";
echo "<td>" . $row['titel'] . "</td>";
echo "<td>" . $row['content'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
$con = mysql_connect("SERVER","USER","PASSWORD");
if (!$con)
{
die('Kon geen verbinding maken... Error: ' . mysql_error());
}
mysql_select_db("DATABASE", $con);
$result = mysql_query("SELECT * FROM AlgemeneTeksten");
echo "<table border='1'>
<tr>
<th>ID</th>
<th>Titel</th>
<th>Content</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['ID'] . "</td>";
echo "<td>" . $row['titel'] . "</td>";
echo "<td>" . $row['content'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
SQL Beginnershandleiding
Begin daarmee, staat alles in, want je doet ook dingen als geen foutafhandeling wat wel moet.
Begin daarmee, staat alles in, want je doet ook dingen als geen foutafhandeling wat wel moet.




