De code:
Het probleem: Ik wil dat de $forumname in de <title> weergegeven wordt. $forumname staat in de while lus en bevat $r->naam. Nu had ik zelf ook al gezien dat dit niet kan werken. Maar hoe krijg ik het resultaat vanuit mijn while lus nou naar boven? Dus dat die $forumname helemaal naar boven gaat.
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
| <?php include('config.php'); $pagetitle = $forumname; include('header.php'); echo "<title>$pagetitle</title>"; ?> <table bgcolor="<? echo $tablebgcolor ?>" border="0" cellspacing="1" width="752"> <tr> <td bgcolor="<? echo $color1 ?>" colspan="6"><? echo "<a href=\"index.php\">$forumnaam index .:. $pagetitle</a>"; ?></td> </tr> <tr> <td bgcolor="<? echo $color1 ?>" width="14"></td> <td bgcolor="<? echo $color1 ?>" width="394"><b>Titel</b></td> <td bgcolor="<? echo $color1 ?>" width="54" align="center"><b>Replies</b></td> <td bgcolor="<? echo $color1 ?>" width="99" align="center"><b>Auteur</b></td> <td bgcolor="<? echo $color1 ?>" width="54" align="center"><b>Views</b></td> <td bgcolor="<? echo $color1 ?>" width="98" align="center"><b>Last Post</b></td> </tr> <?php mysql_connect("$host", "$user", "$pass"); mysql_select_db("$db"); $query = mysql_query("SELECT m.username, f.naam, t.* FROM members m, forums f, topics t WHERE t.forum_id = '$forum' AND f.forum_id = t.forum_id AND t.starter_id=m.user_id"); $forum = addslashes($forum); while ($r = mysql_fetch_object($query)) { $topic_starter = htmlspecialchars($r->username); $topic_title = htmlspecialchars($r->title); $topic_id = $r->topic_id; $forumname = $r->naam; echo "<tr> <td bgcolor=\"$color1\" width=\"14\"><img src=\"images/folder.gif\"></td> <td bgcolor=\"$color2\" width=\"394\">$topic_title</td> <td bgcolor=\"$color1\" width=\"54\" align=\"center\">Replies</td> <td bgcolor=\"$color2\" width=\"99\" align=\"center\">$topic_starter</td> <td bgcolor=\"$color1\" width=\"54\" align=\"center\">Views</td> <td bgcolor=\"$color2\" width=\"98\" align=\"center\">Last Post</td> </tr>"; } include('footer.php'); ?> |
Het probleem: Ik wil dat de $forumname in de <title> weergegeven wordt. $forumname staat in de while lus en bevat $r->naam. Nu had ik zelf ook al gezien dat dit niet kan werken. Maar hoe krijg ik het resultaat vanuit mijn while lus nou naar boven? Dus dat die $forumname helemaal naar boven gaat.