Jump to content

[SOLVED] WTH? Whats wrong here?


Xyphon

Recommended Posts

Its the script that is the problem

 

this should work

 

<?php
include('Connect.php');
include('top.php');
$result = mysql_query("SELECT * FROM news_comments");

echo "<table border='1'>
<tr>
<th>Hi,<br /> It's Xyphon. I have just made the news page, I hope you like it! Please, leave comments here!</th>
</tr></table>";
echo "<table border='1' width='500'>";
echo "<tr> <td> <a href='postcomment.php'>Post Comment</a></td>";
echo "<td> <a href='viewcomments.php'>View Comments</a></td></tr></table>";

if(mysql_num_rows($result)==0){
echo "There are no current comments. Layout issues may accure.";
}
else
{
while($row = mysql_fetch_array($result)){
echo "<table border='1' width='500' height='20'>";
echo "<br /><br />";
echo "<tr>";
echo "<td><center><b>Username: </b><br />" . $row['username'] .  "</center></td>";
echo "<td><center><b>ID: </b><br />" . $row['user_id'] .  "</center></td></tr></table>";
echo "<table border='1' width='500' height='20'><tr><td><b>Comment:</b>";
echo "<td>" . $row['comment'] . "</td>";
echo "</tr></table>";
}
}
echo "</table>";
include('bottom.php');
?>

Link to comment
Share on other sites

I fixed one problem

 

echo "<table border='1' width='500' height='20'>";

echo "<br /><br />";

echo "<tr>";

echo "<td><center><b>Username: </b><br />" . $row['username'] .  "</center></td>";

echo "<td><center><b>ID: </b><br />" . $row['user_id'] .  "</center></td></tr></table>";

echo "<table border='1' width='500' height='20'><tr><td><b>Comment:</b>";

echo "<td>" . $row['comment'] . "</td>";

echo "</tr></table>";

 

You were missing a </table>, which merge <td> with the bottom.php page.

 

I am still looking.

 

 

Like i said, I am horrible with HTML.

Link to comment
Share on other sites

I fixed one problem

 

echo "<table border='1' width='500' height='20'>";

echo "<br /><br />";

echo "<tr>";

echo "<td><center><b>Username: </b><br />" . $row['username'] .  "</center></td>";

echo "<td><center><b>ID: </b><br />" . $row['user_id'] .  "</center></td></tr></table>";

echo "<table border='1' width='500' height='20'><tr><td><b>Comment:</b>";

echo "<td>" . $row['comment'] . "</td>";

echo "</tr></table>";

 

You were missing a </table>, which merge <td> with the bottom.php page.

 

I am still looking.

 

 

Like i said, I am horrible with HTML.

 

Nops it said

echo "</tr>";

{

echo "</table>";

Link to comment
Share on other sites

 

Please replace the script.

 

Remove all updates I made, including what I gave you for bottom.php

 

just put this

 

<?php
include('Connect.php');
include('top.php');
$result = mysql_query("SELECT * FROM news_comments");

echo "<table border='1'>
<tr>
<th>Hi,<br /> It's Xyphon. I have just made the news page, I hope you like it! Please, leave comments here!</th>
</tr></table>";
echo "<table border='1' width='500'>";
echo "<tr> <td> <a href='postcomment.php'>Post Comment</a></td>";
echo "<td> <a href='viewcomments.php'>View Comments</a></td></tr></table>";

if(!$row = mysql_fetch_array($result)){
echo "There are no current comments. Layout issues may accure.";
}
else
{

echo "<table border='1' width='500' height='20'>";
echo "<br /><br />";
echo "<tr>";
echo "<td><center><b>Username: </b><br />" . $row['username'] .  "</center></td>";
echo "<td><center><b>ID: </b><br />" . $row['user_id'] .  "</center></td></tr></table>";
echo "<table border='1' width='500' height='20'><tr><td><b>Comment:</b>";
echo "<td>" . $row['comment'] . "</td>";
echo "</tr></table>";
}
echo "</table>";
include('bottom.php');
?>

Link to comment
Share on other sites

try

 

 

this time it has to work.

 

<?php
include('Connect.php');
include('top.php');
$result = mysql_query("SELECT * FROM news_comments");

echo "<table border='1'>
<tr>
<th>Hi,<br /> It's Xyphon. I have just made the news page, I hope you like it! Please, leave comments here!</th>
</tr></table>";
echo "<table border='1' width='500'>";
echo "<tr> <td> <a href='postcomment.php'>Post Comment</a></td>";
echo "<td> <a href='viewcomments.php'>View Comments</a></td></tr></table>";

if(!$row = mysql_fetch_array($result)){
echo "There are no current comments. Layout issues may accure.";
}
else
{

echo "<table border='1' width='500' height='20'>";
echo "<br /><br />";
echo "<tr>";
echo "<td><center><b>Username: </b><br />" . $row['username'] .  "</center></td>";
echo "<td><center><b>ID: </b><br />" . $row['user_id'] .  "</center></td></tr></table>";
echo "<table border='1' width='500' height='20'><tr><td><b>Comment:</b>";
echo "<td>" . $row['comment'] . "</td>";
echo "</tr></table>";
}

include('bottom.php');
?>

 

 

problem isnt the php, its the HTML

Link to comment
Share on other sites

Ugh. For some reason now my display will only display the FIRST comment made..

 

Thats because you need to use a WHILE() statement.

 

try

 

<?php
include('Connect.php');
include('top.php');
$result = mysql_query("SELECT * FROM news_comments");

echo "<table border='1'>
<tr>
<th>Hi,<br /> It's Xyphon. I have just made the news page, I hope you like it! Please, leave comments here!</th>
</tr></table>";
echo "<table border='1' width='500'>";
echo "<tr> <td> <a href='postcomment.php'>Post Comment</a></td>";
echo "<td> <a href='viewcomments.php'>View Comments</a></td></tr></table>";

if(!$row = mysql_fetch_array($result)){
echo "There are no current comments. Layout issues may accure.";
}
else
{
while($row = mysql_fetch_array($result)){
echo "<table border='1' width='500' height='20'>";
echo "<br /><br />";
echo "<tr>";
echo "<td><center><b>Username: </b><br />" . $row['username'] .  "</center></td>";
echo "<td><center><b>ID: </b><br />" . $row['user_id'] .  "</center></td></tr></table>";
echo "<table border='1' width='500' height='20'><tr><td><b>Comment:</b>";
echo "<td>" . $row['comment'] . "</td>";
echo "</tr></table>";
}
}
include('bottom.php');
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.