Hi,
Ik ben bezig met mijn Harry Potter RPG, maar ik krijg een aantal bugs. Kunnen jullie me daarbij helpen om het op te lossen.
Goudgrijp script:
Als ik naar ?p=kluis&p=2 wil gaan , dan wilt hij niet werken.
code
PHP
}
elseif(isset($_GET['p']) && $_GET['p'] == 'bezoek')
{
$sql = $core->mysql->query("SELECT galjoenen FROM kluis WHERE id = '".$_GET['p']."'");
$fetch = $core->mysql->fetch($sql);
echo $fetch['galjoenen'];
}
Commentaar script:
Bij mijn commentaar script krijg ik de volgende errors:
Warning: mysql_query() expects parameter 1 to be string, resource given in C:\wamp\www\hogwarts\includes\class\mysql.class.php on line 63
MySQL error:
Query is niet uitgevoerd
Query: Resource id #15 LIMIT 1 OFFSET 0
Melding: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #15 LIMIT 1 OFFSET 0' at line 1
Code
PHP
<?php
include 'includes/config.php';
include 'includes/header.php';
if(isset($_GET['id']))
{
$sql = $core->mysql->query("SELECT
id,
titel,
inhoud,
lid_id,
datum
FROM
nieuws
WHERE id = '".$_GET['id']."'
");
$fetch = $core->mysql->fetch($sql);
$sqln = $core->mysql->query("SELECT naam FROM leden WHERE id = '".$fetch['lid_id']."'");
$fetchn = $core->mysql->fetch($sqln);
if($core->mysql->num_rows($sql) >= 1)
{
echo '<h1>'.ucfirst($fetch['titel']).'</h1>
'.$fetch['inhoud'].'<br /><br />
Gepost door <strong>'.ucfirst(htmlentities($fetchn['naam'])).'</strong> op '.$fetch['datum'].'<br /><br />
<a href="">Reageer</a><br /><br />
<h1>Reacties</h1>';
$perpage = 1; // Resultaten per pagina
$query = $core->mysql->query("SELECT
id,
lid_id,
bericht,
datum
FROM
comments
WHERE
nieuws_id = '".$_GET['id']."'
");
$p = (isset($_GET['p']) && ctype_digit($_GET['p']) ? $_GET['p'] : 1);
$total = $core->mysql->num_rows($core->mysql->query($query)) or die(mysql_error());
$pages = ceil($total/$perpage);
if($p > $pages){ $p = 1; }
if($pages == 1 || $p == 1){
$start = 0;
}
else{
$start = ($p-1)*$perpage;
}
$sqld = $core->mysql->query($query." LIMIT ".$perpage." OFFSET ".$start."");
if($core->mysql->num_rows($sqld) >= 1)
{
while($fetchd = $core->mysql->fetch($sqld))
{
$start ++;
$sqlnd = $core->mysql->query("SELECT naam FROM leden WHERE id = '".$fetchd['lid_id']."'");
$fetchnd = $core->mysql->fetch($sqlnd);
echo 'Gepost door '.htmlentities(ucfirst($fetchnd['naam'])).' op '.$fetchd['datum'].'<br /><br /> '.$fetchd['bericht'].'<br /><hr /><br />';
}
echo '<div style="text-align: center;">Pagina (<strong>'.$p.'</strong> van de '.$pages.')</div><br />';
echo '</table>';
if($p != 1){
?>
<div style="text-align: center;"><br /><a href="?p=<?php echo $p-1; ?>">Vorige</a></div>
<?php
}
if($p < $pages){
?>
<div style="text-align: center;"><br /><a href="?p=<?php echo $p+1; ?>">Volgende</a> »</div>
<?php
}
}
else
{
echo '<div class="error">Er zijn geen reacties.</div>';
}
}
else
{
echo '<div class="error">Deze pagina bestaat niet.</div>';
}
}
include 'includes/footer.php';
?>
Toon Meer