I'm new to PHP and working my way through Kevin Yank's Sitepoint book (Build Your Own Database Driven Web Site using PHP and MySQL; 4th Edition).
I can create a list of all existing jokes in the database (pp.126-131), but it does not say and I cannot figure out how to list corresponding data from another field for each entry in a separate adjacent column (i.e. how to list the date of each joke alongside the text).
The code I'm using is below (using separate docs for the 'index' (php) and 'jokes' (html with php), as per Yank's advice.
Thanks in advance for advice of what I need to include to do this,
$result = mysqli_query($link, 'SELECT joketext FROM joke');
$error = 'Error fetching jokes: ' . mysqli_error($link);
while ($row = mysqli_fetch_array($result))
$jokes = $row['joketext'];
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
xml :lang="en" lang="en">
<title>List of Jokes</title>
content="text/html; charset=utf-8" />
<p>Here are all the jokes in the database:</p>
<?php foreach ($jokes as $joke): ?>
<?php echo htmlspecialchars($joke, ENT_QUOTES, 'UTF-8'); ?>
<?php endforeach; ?>