saya sedang belajar menggunakan PHP dengan operasi database MySQL dan
saya coba2 membuat semacam post buletin atau forum gitu jadi disanakan
ada fungsi 'while' bersarang antara 'groups forum' dengan 'forum'
kodenya ada dibawah ini, namun ketika di jalankan ada peringatan
'parse error' yang menuju ke baris terakhir padahal baris terakhir
cuman akhir tag html doang ini kenapa yah. :(
//===========>mulai kode
<?php
require_once("config.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=iso-8859-1">
<title>::: dhieBB - index :::</title>
<body>
<?php
//ambil group dari database
$get_group = "select * from forum_groups order by group_id asc";
$get_group_res = mysql_query($get_group,$conn) or die(mysql_error());
if (mysql_num_rows($get_group_res) < 1) {
//jika tidak ada group dalam forum ini maka muncul peringatan
echo "<P><em>Belum ada group forum.</em></p> \n";
exit;
} else {
//buat string untuk penampakan
echo "<table cellpadding=0 cellspacing=0 border=1 width=90%> \n";
echo "<tr> \n";
echo "<td>Group di Forum ini</td> \n";
echo "</tr> \n";
echo "<tr><td> \n";
echo "<table width=100% ailgn=center cellpadding=0 cellspacing=0> \n";
echo "<tr> \n";
echo "<td align=center>Judul forum</td> \n";
echo "<td width=30 aign=center>post</td> \n";
echo "<td width=150 align=center>posting terakhir</td> \n";
echo "</tr> \n";
echo "</table></td></tr> \n";
while ($group_info = mysql_fetch_array($get_group_res)) {
$group_id = $group_info['group_id'];
$group_title = $group_info['group_title']);
//ambil forum
$get_forum = "select * from forum_main where group_id=$group_id";
$get_forum_res = mysql_query($get_forum,$conn) or
die(mysql_error());
//tampilkan
echo "<tr> \n";
echo "<td><strong>$group_title</strong> \n";
echo "</tr> \n";
if (mysql_num_rows($get_forum_res) < 1) {
//jika tidak ada forum dalam forum ini maka muncul peringatan
echo "<P><em>Forum masih kosong.</em></p> \n";
exit;
} else {
echo "<tr> \n";
echo "<td> \n";
echo "<table width=100% align=center cellpadding=0
cellspacing=0> \n";
while ($forum_info = mysql_fetch_array($get_forum_res)) {
$forum_title = stripslashes($forum_info['forum_title']);
//tampilkan
echo "<tr> \n";
echo "<td>$forum_title</td> \n";
echo "<td width=30 align=center>xx</td> \n";
echo "<td width=150 align=center>xxx</td> \n";
echo "</tr> \n";
}
echo "</table></td></tr> \n";
}
?>
<tr><td bgcolor=#0088ff align=center>~~forum error terus~~</td></tr>
</table>
</body>
</html>
//===========>akhir kode
---
Website: http://toekangweb.or.id/
Arsip milis : http://groups.yahoo.com/group/toekangweb/messages
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/toekangweb/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/