For the jokes section of my site I have everything set up teh submit and view pages, however I am stuggling listing the list of jokes and links on the index page.
At the moment my script is
<?php
# Include database functions file
include('/home/www/teenonyM/scripts/database_functions.php');
# Open MYSQL Connection
OpenConnection();
# Assign a value to the query so that it can be checked by the error handler
$query = "SELECT `id`, `title` FROM phpbb_content_jokes";
@mysql_query($query, $connection)
or ThrowError("error with query: " . mysql_error() . "\n\nQuery: " . $query);
# Assign the result of the query a variable
$result = mysql_query($query);
# Assign values to the rows
while( $row = mysql_fetch_array($result) )
{
$id = $row['id'];
$title = $row['title'];
}
?>
With the query executed being
SELECT id, title FROM phpbb_content_jokes
which in phpMyAdmin displays (see attached image.)
On the index page I wish to list all the jokes currently in the database and have the joke titles as links to the respective pages (i.e view.php?id=1)
I understand how to echo one row in for this situation, but am not sure how to echo more than one and in a list. Can anyone help me with this?