Greetings,
When I execute this code the table appears as [Book | Year Published | Author] and nothing else. I get no errors from Apache2.2 or MySQL.I am using Windows xp Home edition, English. If I use viewsource the table reads <tr><td><?= $row[0] ?></td><td><?= $row[1] ?></td><td><?= $row[2] ?></td></tr> etc. I have tapped all resources such as thescripts,mysq l ref,php.net,Pea r and many forums trying to solve the mystery. The code is from oreillys "Programmin g PHP Second Edition." Example 8-1. Display Book Information page 199. Any help would be appreciated.
Sincerely, Richard M.
code:
[php]
<html><head><ti tle>Library Books</title></head>
<body>
<table border=1>
<tr><th>Book</th><th>Year Published</th><th>Author</th></tr>
<?php
// connect
require_once('D B.php');
$db = DB::connect("my sql://root:rich@local host/library");
if (DB::iserror($d b)) {
die($db->getMessage() );
}
// issue the query
$mysql = "SELECT books.title,boo ks.pub_year,aut hors.name
FROM books, authors
WHERE books.authorid= authors.authori d
ORDER BY books.pub_year ASC";
$q = $db->query($mysql );
if (DB::iserror($q )) {
die($q->getMessage() );
}
error_reporting (E_ALL);
ini_set('error_ reporting', E_ALL);
// generate the table
while ($q->fetchInto($row )) {
?>
<tr><td><?= $row[0] ?></td>
<td><?= $row[1] ?></td>
<td><?= $row[2] ?></td>
</tr>
<?php
}
?>
</table>
</body></html>[/php]
Read the Posting Guidelines before you post in this forum!
Especially the part about enclosing code within [php] or [code] tags!!
moderator
When I execute this code the table appears as [Book | Year Published | Author] and nothing else. I get no errors from Apache2.2 or MySQL.I am using Windows xp Home edition, English. If I use viewsource the table reads <tr><td><?= $row[0] ?></td><td><?= $row[1] ?></td><td><?= $row[2] ?></td></tr> etc. I have tapped all resources such as thescripts,mysq l ref,php.net,Pea r and many forums trying to solve the mystery. The code is from oreillys "Programmin g PHP Second Edition." Example 8-1. Display Book Information page 199. Any help would be appreciated.
Sincerely, Richard M.
code:
[php]
<html><head><ti tle>Library Books</title></head>
<body>
<table border=1>
<tr><th>Book</th><th>Year Published</th><th>Author</th></tr>
<?php
// connect
require_once('D B.php');
$db = DB::connect("my sql://root:rich@local host/library");
if (DB::iserror($d b)) {
die($db->getMessage() );
}
// issue the query
$mysql = "SELECT books.title,boo ks.pub_year,aut hors.name
FROM books, authors
WHERE books.authorid= authors.authori d
ORDER BY books.pub_year ASC";
$q = $db->query($mysql );
if (DB::iserror($q )) {
die($q->getMessage() );
}
error_reporting (E_ALL);
ini_set('error_ reporting', E_ALL);
// generate the table
while ($q->fetchInto($row )) {
?>
<tr><td><?= $row[0] ?></td>
<td><?= $row[1] ?></td>
<td><?= $row[2] ?></td>
</tr>
<?php
}
?>
</table>
</body></html>[/php]
Read the Posting Guidelines before you post in this forum!
Especially the part about enclosing code within [php] or [code] tags!!
moderator
Comment