Link to home
Start Free TrialLog in
Avatar of mhoggatt1
mhoggatt1

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of StormyWaters
StormyWaters
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mhoggatt1
mhoggatt1

ASKER

Well that was easy enough. I thought it would be more difficult.
Thanks
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>
Shouldn't you open your own question?