Kan fout niet vinden
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
30
31
32
33
34
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
30
31
32
33
34
<?
include("connect.php");
$sql = "SELECT id,titel,datum, naam FROM topics ORDER BY id DESC";
$res = mysql_query($sql);
if (mysql_num_rows($res) >= 1)
{
while ($row = mysql_fetch_array($res))
{
// het aantal reacties weergeven
$nsql = "SELECT tid FROM replys WHERE tid = '" . $row[id] . "'";
$nres = mysql_query($nsql);
$msg = mysql_num_rows($nres);
$row['datum'] = substr($row['datum'], 0, 10);
echo "<table width=/"100%/" height=/"100%/" cellpadding=/"3/" cellspacing=/"0/" border=/"0/">";
echo "<tr><td align=/"left/" valign=/"top/">Forum</td><td align=/"left/" valign=/"top/">Door:</td><td align=/"left/" valign=/"top/">Op:</td><td align=/"left/" valign=/"top/">reactie/'s:</td></tr>
<tr><td align=/"left/" valign=/"top/"><a href=/"replys.php?id=/" . $row['id'] . /"\/">" . $row['titel'] ./"</a></td><td align=/"left/" valign=/"top/">/" . $row['naam'] ./"</td><td align=/"left/" valign=/"top/">/" . $row['datum'] . /"</td><td align=/"left/" valign=/"top/">/" . $msg . /"</td></tr>
</table>";
}
}
else
{
echo "Er zijn nog geen topics.";
}
echo "<p>Nieuwe topic <a href=\"addtopic.php\">toevoegen</a>";
?>
include("connect.php");
$sql = "SELECT id,titel,datum, naam FROM topics ORDER BY id DESC";
$res = mysql_query($sql);
if (mysql_num_rows($res) >= 1)
{
while ($row = mysql_fetch_array($res))
{
// het aantal reacties weergeven
$nsql = "SELECT tid FROM replys WHERE tid = '" . $row[id] . "'";
$nres = mysql_query($nsql);
$msg = mysql_num_rows($nres);
$row['datum'] = substr($row['datum'], 0, 10);
echo "<table width=/"100%/" height=/"100%/" cellpadding=/"3/" cellspacing=/"0/" border=/"0/">";
echo "<tr><td align=/"left/" valign=/"top/">Forum</td><td align=/"left/" valign=/"top/">Door:</td><td align=/"left/" valign=/"top/">Op:</td><td align=/"left/" valign=/"top/">reactie/'s:</td></tr>
<tr><td align=/"left/" valign=/"top/"><a href=/"replys.php?id=/" . $row['id'] . /"\/">" . $row['titel'] ./"</a></td><td align=/"left/" valign=/"top/">/" . $row['naam'] ./"</td><td align=/"left/" valign=/"top/">/" . $row['datum'] . /"</td><td align=/"left/" valign=/"top/">/" . $msg . /"</td></tr>
</table>";
}
}
else
{
echo "Er zijn nog geen topics.";
}
echo "<p>Nieuwe topic <a href=\"addtopic.php\">toevoegen</a>";
?>
Wie kan mij helpen?
Bovendien kunnen wij niet de fout ruiken.
Code (php)
1
2
3
2
3
<?PHP
echo "<table width=/"100%/" height=/"100%/" cellpadding=/"3/" cellspacing=/"0/" border=/"0/">";
?>
echo "<table width=/"100%/" height=/"100%/" cellpadding=/"3/" cellspacing=/"0/" border=/"0/">";
?>
bedoel je niet
Code (php)
1
2
3
2
3
<?PHP
echo "<table width=\"100%\" height=\"100%\" cellpadding=\"3\" cellspacing=\"0\" border=\"0\">";
?>
echo "<table width=\"100%\" height=\"100%\" cellpadding=\"3\" cellspacing=\"0\" border=\"0\">";
?>
Ik heb net dit erin gezet:
En de pagina blijft nog steeds leeg. Ik weet dat de fout in het table gedeelte zit maar ik zie het niet.
En uuh, fouten kun je niet ruiken!
Dat je geen syntax errors te zien krijgt, wijst erop dat de display_errors instelling in je php.ini uitgeschakeld is. Zet deze dus eens aan in je php.ini of doe dat via een .htaccess bestandje met de volgende regel:
Code (php)
1
2
3
4
5
2
3
4
5
echo "<table width=\"100%\" height=\"100%\" cellpadding=\"3\" cellspacing=\"0\" border=\"0\">";
echo "<tr><td align=\"left\" valign=\"top\">Forum</td><td align=\"left\" valign=\"top\">Door:</td><td align=\"left\" valign=\"top\">Op:</td><td align=\"left\" valign=\"top\">reactie's:</td></tr>
<tr><td align=\"left\" valign=\"top\"><a href=\"replys.php?id=" . $row['id'] . " \">" . $row['titel'] ."</a></td><td align=\"left\" valign=\"top\">" . $row['naam'] ."</td><td align=\"left\" valign=\"top\">" . $row['datum'] . "</td><td align=\"left\" valign=\"top\">" . $msg . "</td></tr>
</table>";
echo "<tr><td align=\"left\" valign=\"top\">Forum</td><td align=\"left\" valign=\"top\">Door:</td><td align=\"left\" valign=\"top\">Op:</td><td align=\"left\" valign=\"top\">reactie's:</td></tr>
<tr><td align=\"left\" valign=\"top\"><a href=\"replys.php?id=" . $row['id'] . " \">" . $row['titel'] ."</a></td><td align=\"left\" valign=\"top\">" . $row['naam'] ."</td><td align=\"left\" valign=\"top\">" . $row['datum'] . "</td><td align=\"left\" valign=\"top\">" . $msg . "</td></tr>
</table>";
Het is een zootje maar ik zie weer wat op het scherm.
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
<?php
echo '<table width="100%" height="100%" cellpadding="3" cellspacing="0" border="0">';
echo '<tr><td align="left" valign="top">Forum</td><td align="left" valign="top">Door:</td><td align="left" valign="top">Op:</td><td align="left" valign="top">reactie\'s:</td></tr>
<tr><td align="left" valign="top"><a href="replys.php?id=' . $row['id'] . ' ">' . $row['titel'] .'</a></td><td align="left" valign="top">' . $row['naam'] .'</td><td align="left" valign="top">' . $row['datum'] . '</td><td align="left" valign="top">' . $msg . '</td></tr>
</table>';
?>
echo '<table width="100%" height="100%" cellpadding="3" cellspacing="0" border="0">';
echo '<tr><td align="left" valign="top">Forum</td><td align="left" valign="top">Door:</td><td align="left" valign="top">Op:</td><td align="left" valign="top">reactie\'s:</td></tr>
<tr><td align="left" valign="top"><a href="replys.php?id=' . $row['id'] . ' ">' . $row['titel'] .'</a></td><td align="left" valign="top">' . $row['naam'] .'</td><td align="left" valign="top">' . $row['datum'] . '</td><td align="left" valign="top">' . $msg . '</td></tr>
</table>';
?>
geeft "Mijn naam: Jos"
geeft "Mijn naam: $naam"
Strings hoor je volgens php aan elkaar te plakken met een .