• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

PHP and tables

In the code below I have a table with 1 row and 3 colums. How is the best way to place the 3 echo statements into the table, such as the first statement in the first column, etc.
Thanks,
Michael
0
mhoggatt1
Asked:
mhoggatt1
  • 2
  • 2
1 Solution
 
StormyWatersCommented:
<table>
<tr>
<td><?php echo "..."?></td>
<td><?php echo "..."?></td>
<td><?php echo "..."?></td>
</tr>
</table>
0
 
mhoggatt1Author Commented:
Well that was easy enough. I thought it would be more difficult.
Thanks
0
 
jcw20Commented:
Ok here is my code :

My question is  how do i change it for each record to in a separte row  in a table format.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<title>Joke CMS: Manage Authors</title>
<meta http-equiv="content-type"
    content="text/html; charset=iso-8859-1" />
</head>
<body>
<!--<h1>Manage Authors</h1></!-->

<?php
include'header.inc.php';
$dbcnx = @mysql_connect('10.10.10.4', 'root','fireman');
if (!$dbcnx) {
  exit('<p>Unable to connect to the ' .
      'database server at this time.</p>');
}

if (!@mysql_select_db('guest')) {
  exit('<p>Unable to locate the joke ' .
      'database at this time.</p>');
}

$authors = @mysql_query('SELECT id, firstname,lastname,email,Comment FROM guest');
if (!$authors) {
  exit('<p>Error retrieving authors from database!<br />'.
      'Error: ' . mysql_error() . '</p>');
}

while ($author = mysql_fetch_array($authors)) {
  $id = $author['id'];
  $firstname = htmlspecialchars($author['firstname']);
    $lastname = htmlspecialchars($author['lastname']);
      $Comment = htmlspecialchars($author['Comment']);
  $email = htmlspecialchars($author['email']);
 
  echo "firstname: ".$author["firstname"]."<br>\n";
     echo "Last Name: ".$author["lastname"]."<br>\n";
   echo "email: ".$author["email"]."<br>\n";
    echo "Comment: ".$author["Comment"]."<br>\n";
      "<a href='editauthor.php?id=$id'>Edit</a> ".
      "<a href='deleteauthor.php?id=$id'>Delete</a></li>";
        



        
}
?>
</ul>
<p><a href="newauthor.php">Add new author</a></p>
<p><a href="index.html">Return to front page</a></p>
</body>
</html>
0
 
StormyWatersCommented:
Shouldn't you open your own question?
0
 
jcw20Commented:
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now