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
Thanks,
Michael
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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,C omment 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"]."<b r>\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=$i d'>Edit</a > ".
"<a href='deleteauthor.php?id= $id'>Delet e</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>
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
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,C
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['
$lastname = htmlspecialchars($author['
$Comment = htmlspecialchars($author['
$email = htmlspecialchars($author['
echo "firstname: ".$author["firstname"]."<b
echo "Last Name: ".$author["lastname"]."<br
echo "email: ".$author["email"]."<br>\n
echo "Comment: ".$author["Comment"]."<br>
"<a href='editauthor.php?id=$i
"<a href='deleteauthor.php?id=
}
?>
</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?
i do have my own questionopen at https://www.experts-exchange.com/questions/21444013/Php-Guest-Book-table-format-trouble.html
no anser
no anser
ASKER
Thanks