Hallo cpers,
Ik heb een forum aan het maken, je kan een lijst selecteren met een catogorie.
Maar als ik die lijst selecteer, krijg ik een error.
PHP
include ("config.php");
echo ("<html>
<head>
<title>Colombo</title>
<link rel=\"stylesheet\" type=\"text/css\" href=\"../static/css/style.css\" />
</head>
<body>");
if (isset($_GET['type'])) {
$type = mysql_real_escape_string($_GET['type']);
$sql = $db->query("SELECT * FROM `Topics` WHERE `type`='{$type}' ORDER by `time` DESC LIMIT $begin, $maxpage");
$rows = $db->num_rows($sql);
if ($rows == 0) {
echo ("<tr><td>Er zijn geen topics in deze categorie.</td></tr>");
} else {
echo ("<tr>
<td width=\"40%\"><b>Onderwerp</b></td>
<td width=\"20%\"><b>Door</b></td>
<td width=\"10%\"><b>Reacties</b></td>
<td width=\"30%\"><b>Datum</b></td>
</tr>");
$sql = $db->query("SELECT * FROM `Topics` WHERE `type`='{$type}' ORDER by `time` DESC LIMIT $begin, $maxpage");
while($result = $db->fetch_object($sql)) {
$sql = $db->query("SELECT `tid` FROM `Reactions` WHERE `tid`='{$result->id}'");
$reactions = $db->num_rows($sql);
$time = gmdate("d-m-Y H:i:s", $assoc->time);
echo ("<tr>
<td width=\"40%\"><a href=\"watch.php?tid={$result->id}\">{$result->subject}</a></td>
<td width=\"20%\"><a href=\"user.php?user={$result->user}\">{{$result->user}}</a></td>
<td width=\"10%\">{$reactions}</td>
<td width=\"30%\">{$time}</td>
</tr>");
}
/*
echo " <tr>
<td class=\"text\" colspan=\"4\">Pagina";
$sql = mysql_query("SELECT * FROM `Topics` WHERE `type`='{$_GET['type']}'");
$rows = mysql_num_rows($sql);
foreach (range(1, ceil($rows / $max)) AS $i) {
$i--;
echo " <a href=\"?do=showlist&type={$_GET['type']}&p=$i\">". ($i+1) ."</a> ";
}
echo " </td>
</tr>";
*/
}
}
Toon Meer
Als ik index.php?type=rip doe dan krijg ik deze error.
PHP
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'apache'@'localhost' (using password: NO) in /home/xxx/domains/xxx/public_html/forum/index.php on line 12
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/xxx/domains/xxx/public_html/forum/index.php on line 12
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xxx/domains/xxx/public_html/forum/class/db.class.php on line 21
Er zijn geen topics in deze categorie.