Nieuw lid |
|
Ik ga even een lange uitleg doen van mijn probleem
Het nieuwssysteem dat ik gebruik ziet er als volgt uit
<?PHP
include("functions/text2ubb.php");
// nieuws.php
// deze zou je bijv. kunnen includen op je index pagina
$sQuery = "SELECT * FROM nieuws ORDER BY id DESC LIMIT 0, ".$max['nieuws'];
$sResult = MySQL_Query($sQuery) or report_mysql("Nieuws ophalen", __FILE__, __LINE__, $sQuery);
echo "<Center>";
while($sRecord = MySQL_Fetch_Assoc($sResult))
{
echo "<!-- Contentbox -->";
echo "<br><table cellspacing=0 cellpadding=0 class=\"body\">";
echo "<tr><td background=\"images/contentboxTop.gif\" width=377 height=33>";
echo " <b>".$sRecord['titel']."</b> <div align=\"left\"> geschreven door ".$sRecord['door']." op ".$sRecord['datum']." om ".$sRecord['tijd']."</div>";
echo "</td></tr>";
echo "<tr><td background=\"images/contentboxBack.gif\">";
echo "<table cellspacing=0 cellpadding=5 class=\"body\">";
echo "<tr>";
echo "<td valign=\"top\"><img src=\"images/clannewsThumb.gif\" alt=\"\"></td>";
echo "<td valign=\"top\" width=270>";
text2ubb($sRecord['text']);
echo "</tr>";
echo "</table>";
echo "</td></tr>";
echo "<tr><td><img src=\"images/contentboxBottom.gif\" alt=\"\" /></td></tr>";
echo "</table>";
echo "<!-- /Contentbox -->";
}
?>
<?PHP include("functions/text2ubb.php"); // nieuws.php // deze zou je bijv. kunnen includen op je index pagina $sQuery = "SELECT * FROM nieuws ORDER BY id DESC LIMIT 0, ".$max['nieuws']; $sResult = MySQL_Query($sQuery) or report_mysql ("Nieuws ophalen", __FILE__, __LINE__, $sQuery); { echo "<!-- Contentbox -->"; echo "<br><table cellspacing=0 cellpadding=0 class=\"body\">"; echo "<tr><td background=\"images/contentboxTop.gif\" width=377 height=33>"; echo " <b>".$sRecord['titel']."</b> <div align=\"left\"> geschreven door ".$sRecord['door']." op ".$sRecord['datum']." om ".$sRecord['tijd']."</div>"; echo "<tr><td background=\"images/contentboxBack.gif\">"; echo "<table cellspacing=0 cellpadding=5 class=\"body\">"; echo "<td valign=\"top\"><img src=\"images/clannewsThumb.gif\" alt=\"\"></td>"; echo "<td valign=\"top\" width=270>"; text2ubb($sRecord['text']); echo "<tr><td><img src=\"images/contentboxBottom.gif\" alt=\"\" /></td></tr>"; echo "<!-- /Contentbox -->"; } ?>
-> Dit is wel alleen de code die men te zien krijgt op de nieuwspagina.
In dit nieuwsscript zit echter geen commentsysteem wat ik wel graag zou willen hebben.
Aangezien ik nog maar een paar dagen PHP doe, en ik niet wist hoe eraan te beginnen, vroeg ik aan een maat van mij voor zo'n script, en hij gaf me het volgende:
---bestandsnaam: newscomment.php---
<table border=0 cellpadding=0 cellspacing=0 width=453>
<tr><td width=500 background="images/titmain.jpg" height=30><table height=100%><tr><td width=10></td><td class="body" valign="bottom"><b>News</b></td></tr></table></td></tr>
<tr><td background="images/mainback.jpg">
<?php
$nid = $_GET['nid'];
$query = mysql_query("SELECT * FROM news WHERE id='$nid'");
$obj = mysql_fetch_object($query);
$topic = stripslashes($obj->topic);
$content = stripslashes($obj->content);
?>
<table class="body">
<tr><td width=5></td><td valign="top"><img src="images/nw.gif" alt=""></td>
<td width=365><b>¬ <?php print($topic); ?><br></b>
<font size="0.7">posted by <?php print($obj->poster); ?> on <?php print($obj->date); ?><br></font>
<?php print($content); ?><br>
</td><td width=25></td></tr>
<tr><td width=5></td><td colspan=2><img src="images/line.jpg" alt=""></td></tr>
</table>
<table class="body">
<?php
$query = mysql_query("SELECT * FROM newscomments WHERE newsid='$nid'");
while ($obj = mysql_fetch_object($query)) {
?>
<tr><td width=30></td>
<td width=365><font size="0.7">posted by <?php print($obj->poster); ?> on <?php print($obj->date); if($admin == 1) {?> <a href="index.php?page=deletenewscomment&cid=<?php print($obj->id); ?>" class="small">(delete)</a><?php } ?><br></font>
<?php print($obj->content); ?><br>
</td><td width=25></td></tr>
<tr><td width=5></td><td colspan=2><img src="images/line.jpg" alt="" width=300></td></tr>
<?php
}
?>
</table>
<table><tr>
<td width=30></td><td class="body">
<b>Post Comment:</b>
<form action="index.php?page=postcomment" method="POST">
Name:<br><input type="text" name="poster" class="body"><br>
Comment:<br>
<textarea name="content" rows="4" cols="70" class="body" ></textarea>
<input type="hidden" name="date" value="<?php print(date("d-m-y H:i")); ?>">
<input type="hidden" name="nid" value="<?php print($nid); ?>">
<input type="submit" name="submit" value="Submit">
</form>
</td></tr></table>
</td></tr>
<tr><td background="images/mainbottom.jpg" height=30>
</td></tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 width=453> <tr><td width=500 background="images/titmain.jpg" height=30><table height=100%><tr><td width=10></td><td class="body" valign="bottom"><b>News</b></td></tr></table></td></tr> <tr><td background="images/mainback.jpg"> <?php $nid = $_GET['nid']; $query = mysql_query("SELECT * FROM news WHERE id='$nid'"); ?> <table class="body"> <tr><td width=5></td><td valign="top"><img src="images/nw.gif" alt=""></td> <td width=365><b>¬ <?php print($topic); ?><br></b> <font size="0.7">posted by <?php print($obj->poster); ?> on <?php print($obj->date); ?><br></font> <?php print($content); ?><br> </td><td width=25></td></tr> <tr><td width=5></td><td colspan=2><img src="images/line.jpg" alt=""></td></tr> </table> <table class="body"> <?php $query = mysql_query("SELECT * FROM newscomments WHERE newsid='$nid'"); ?> <tr><td width=30></td> <td width=365><font size="0.7">posted by <?php print($obj->poster); ?> on <?php print($obj->date); if($admin == 1) {?> <a href="index.php?page=deletenewscomment&cid= <?php print($obj->id); ?>" class="small">(delete)</a> <?php } ?><br></font> <?php print($obj->content); ?><br> </td><td width=25></td></tr> <tr><td width=5></td><td colspan=2><img src="images/line.jpg" alt="" width=300></td></tr> <?php } ?> </table> <table><tr> <td width=30></td><td class="body"> <b>Post Comment:</b> <form action="index.php?page=postcomment" method="POST"> Name:<br><input type="text" name="poster" class="body"><br> Comment:<br> <textarea name="content" rows="4" cols="70" class="body" ></textarea> <input type="hidden" name="date" value=" <?php print(date("d-m-y H:i")); ?>"> <input type="hidden" name="nid" value=" <?php print($nid); ?>"> <input type="submit" name="submit" value="Submit"> </form> </td></tr></table> </td></tr> <tr><td background="images/mainbottom.jpg" height=30> </td></tr> </table>
Om naar dit bestand te verwijzen en zo de nieuwspost met daaronder de comments weer te geven gebruikte hij deze link:
<a href="index.php?page=newscomment&nid=<?php print($obj->id); ?>" class="small">Read More (<?php print($comments); ?>)</a>
<a href="index.php?page=newscomment&nid= <?php print($obj->id); ?>" class="small">Read More ( <?php print($comments); ?>)</a>
Nu mijn probleem:
Wanneer ik die link gebruik, geeft mijn site bij elke newspost hetzelfde id aan... Ik begrijp niet echt hoe dit komt en hoe ik het kan voorkomen? Misschien weet iemand van jullie raad:?:
|