I am attempting to create a website, there is an area of main content with text and a picture. Underneath that is a 2 column table. When I click on the links on the left everything works fine, but when I click on the links on the right it does not work properly. Here is the code for my main.inc.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy for Windows (vers 13 April 2006), see www.w3.org">
<title></title>
</head>
<body>
<div id="main">
<!-- Start of main content -->
<p style="margin-left: 2em; float: left;"><img src="ryantossl.jpg" alt="ryantossl" style="float: right; padding: 0.25em;">We have all been there, maybe not right there but you know what I mean. I
figured if every jerk off who manages to get themselves on reality TV can make money while documenting their stupidity for all the world to see I thought I'd get in on the action. I guess my goal
would to have a worldwide highlight reel of awesomeness. Really anything that anybody out there might find hilarious, amazing, brazen, moronic or just outlandish belongs here. Think of it as a
long game of "I never" or a hung over Sunday Afternoon spent smoking a few L's and recapping the previous night's exploits and eventually all the brilliant manuveuers and milestones reached in
your career.</p>
</div><!-- End of main content -->
<table border="0" style="width: 100%">
<tr>
<td><?php
$con = mysql_connect("host","user", "pass") or die('Sorry, could not connect to database server');
mysql_select_db("db", $con) or die('Sorry, could not connect to database');
$query = "SELECT storyid,title,poster,dateandplace from stories order by storyid desc limit 0,5";
$result = mysql_query($query) or die('Sorry, could not get recipes at this time ');if (mysql_num_rows($result) == 0)
{
echo "<h3>Sorry, there are no recipes posted at this time, please try back later.</h3>";
} else
{
while($row=mysql_fetch_array($result, MYSQL_ASSOC))
{
$storyid = $row['storyid'];
$title = $row['title'];
$poster = $row['poster'];
$dateandplace = $row['dateandplace'];
echo "<a href=\"index.php?content=showrecipe&id=$storyid\">$title</a> submitted by $poster<br>\n";
echo"$dateandplace<br><br>\n";
}
}
?></td>
<td><?php
$con = mysql_connect("host","user", "pass") or die('Sorry, could not connect to database server');
mysql_select_db("db", $con) or die('Sorry, could not connect to database');
$query = "SELECT topic, poster, speaker, setup, quote from quotes order by quoteid desc limit 0,5";
$result = mysql_query($query) or die('Sorry, could not get quotes at this time ');if (mysql_num_rows($result) == 0)
{
echo "<h3>Sorry, there are no recipes posted at this time, please try back later.</h3>";
} else
{
while($row=mysql_fetch_array($result, MYSQL_ASSOC))
{
$topic = $row['topic'];
$poster = $row['poster'];
$speaker = $row['speaker'];
$setup = $row['setup'];
$quote = $row['quote'];
echo "<a href=\"index.php?content=showquote&id=$quoteid\">$quote</a>said by $speaker<br>\n";
}
}
?></td>
</tr>
</table>
</body>
</html>
And here is the code for showquote.inc.php(the page that would display the links on the right of the column):
<?php
$con = mysql_connect("host", "user", "pass") or die('Could not connect to server');
mysql_select_db("db", $con) or die('Could not connect to database');
$quoteid = $_GET['id'];
$query = "SELECT topic,poster,speaker,setup,quote from quotes where quoteid=$quoteid";
$result = mysql_query($query) or die('Could not find quote recipe');
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$topic = $row['topic'];
$poster = $row['poster'];
$speaker = $row['speaker'];
$setup = $row['setup'];
$quote = $row['quote'];
$setup = nl2br($setup);
$quote = nl2br($quote);
echo "<h2>$topic</h2>\n";
echo "by $poster <br><br>\n";
echo $speaker . "<br><br>\n";
echo "<h3>setup:</h3>\n";
echo $setup . "<br><br>\n";
echo "<h3>quote:</h3>\n";
echo $quote . "\n";
echo "<br><br>\n";
$query = "SELECT count(qcommentid) from qcomments where quoteid=$quoteid";
$result = mysql_query($query);
$row=mysql_fetch_array($result);
if ($row[0] == 0)
{
echo "No comments posted yet. \n";
echo "<a href=\"index.php?content=newqcomment&id=$quoteid\">Add a qcomment</a>\n";
echo " <a href=\"print.php?id=$quoteid\" target=\"_blank\">Print recipe</a>\n";
echo "<hr>\n";
} else
{
$totrecords = $row[0];
echo $row[0] . "\n";
echo " comments posted. \n";
echo "<a href=\"index.php?content=newqcomment&id=$quoteid\">Add a comment</a>\n";
echo " <a href=\"print.php?id=$quoteid\" target=\"_blank\">Print recipe</a>\n";
echo "<hr>\n";
echo "<h2>Comments:</h2>\n";
if (!isset($_GET['page']))
$thispage = 1;
else
$thispage = $_GET['page'];
$recordsperpage = 5;
$offset = ($thispage - 1) * $recordsperpage;
$totpages = ceil($totrecords / $recordsperpage);
$query = "SELECT date,poster,comment from comments where storyid = $storyid order by commentid desc limit $offset,$recordsperpage";
$result = mysql_query($query) or die('Could not retrieve comments: ' . mysql_error());
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$date = $row['date'];
$poster = $row['poster'];
$qcomment = $row['qcomment'];
$qcomment = nl2br($qcomment);
echo $date . " - posted by " . $poster . "\n";
echo "<br>\n";
echo $comment . "\n";
echo "<br><br>\n";
}
if ($thispage > 1)
{
$page = $thispage - 1;
$prevpage = "<a href=\"index.php?content=showquote&id=$quoteid&page=$page\">Prev</a>";
} else
{
$prevpage = " ";
}
if ($totpages > 1)
{
$bar = '';
for($page = 1; $page <= $totpages; $page++)
{
if ($page == $thispage)
{
$bar .= " $page ";
} else
{
$bar .= " <a href=\"index.php?content=showquote&id=$quoteid&page=$page\">$page</a> ";
}
}
}
if ($thispage < $totpages)
{
$page = $thispage + 1;
$nextpage = " <a href=\"index.php?content=showquote&id=$quoteid&page=$page\">Next</a>";
} else
{
$nextpage = " ";
}
echo "GoTo: " . $prevpage . $bar . $nextpage;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy for Windows (vers 13 April 2006), see www.w3.org">
<title></title>
</head>
<body>
</body>
</html>
Any help or suggestions would be great. Thanks for taking the time