Table recreates within iteself
Posted: Sat Sep 13, 2003 8:56 pm
Hello. I have a PHP script that basically says that while there is data bieng pulled from a database, create a table for each row and display it. The first result works fine. The second result created a table INSIDE the first table. The third table is created inside the second table, etc. That is not cool, and I don't like the way it looks. However, I can't seem to fix it. Here's the code, help is really appreciated.
Code: Select all
<?php
$idd = $_GET['id'];
//pull out user comment and diplay them
$comments = "SELECT * FROM comments WHERE picid='$idd'";
$commentres = mysql_query ($comments, $db);
while ($roww = mysql_fetch_assoc ($commentres))
{
?>
<p></p>
<table width="75%" height="142" border="4" cellpadding="0">
<tr>
<td bordercolor="#FFFFFF" bgcolor="#707070"><font size="2" face="Modern">
<strong> User: </strong><?php echo $roww['poster']; ?> <strong> Date:
</strong><?php echo $roww['date']; ?></font><br> </td>
</tr>
<tr>
<td height="97" bgcolor="#A8A8A8"><font size="2" face="Modern">
<p><strong>Comment:</strong> <?php echo $roww['comment']; }?></p>
</font> <p> </p>
<p> </p></td>
</tr>
</table>
<?php
if ($_SESSION['auth']===true) {
?>
<form name="form1" method="post" action="comment.php">
<p>Comment:<br>
<textarea name="comment" cols="60" rows="6" id="comment"></textarea>
<br>
<input name="picid" type="hidden" id="picid2" value="<?php echo $idd; ?>">
<input type="submit" name="Submit" value="Comment!">
</p>
</form>
<?php } else { echo "You must login to comment"; } ?> </td>
</tr>
</table>