I have writen two functions that pull information from my dba. The first one getContent() placed the text from the dba onto the center column of the page. The right colomn of the page holds the other function that when clicked proccess the request to the getContent function to display the approprite text. This function is getNews(). I however am not able to when I click the link have the getContent display the information within the dba. Does anyone have any Idea on why this is. Bellow is the html for the page and the two funcitons in php
function openTable(){
print("<table cellpadding=\"2\"
border=\"0\">\n\t<tr>\n<td>\n");
}
function closeTable(){
print("</td>\n</tr>\n</table>");
}
function getNews(){
Global $connection;
$today = date("Ymd");
hookUpDb();
$query = "SELECT id,start_date,header,teaser
FROM content
WHERE end_date >= $today AND
start_date <= $today
ORDER BY start_date DESC";
$result = mysql_query($query,$connection);
openTable();
while ($row = mysql_fetch_row($result)){
$id = $row[0];
$start_date = unFormatData($row[1]);
$header = unFormatData($row[2]);
$teaser = unFormatData($row[3]);
print("<h5>$start_date
$header</h5>\n<i>$teaser</i>\n
<br>\n
<a href=\"display.php?story=$id\">Read more...</a>\n
<Br><hr><Br>\n");
}
closeTable();
mysql_free_result($result);
mysql_close($connection);
print("<Br>\n
<hr>No more news available.<Br>\n");
}
function getContent($story){
Global $connection;
hookUpDb();
openTable();
if(!empty($story)){
$query = "SELECT id,start_date,header,teaser, maintext,link
FROM content
WHERE id=$story";
$result = mysql_query($query,$connection);
while ($row = mysql_fetch_row($result)){
$id = $row[0];
$start_date = unFormatData($row[1]);
$header = unFormatData($row[2]);
$teaser = unFormatData($row[3]);
$maintext = unFormatData($row[4]);
$link = unFormatData($row[5]);
print("$maintext\n");
}
mysql_free_result($result);
mysql_close($connection);
}
else{
print("<h5>
Choose article to read from the news on the left.</h5>");
}
closeTable();
}
<table align="center">
<tr>
<td valign="top" class="lh-col">
<?php include("./incfiles/i_menu.inc"); ?>
</td>
<td class="c-col" valign="top">
<?php getContent(); ?>
</td>
<td valign="top" class="rh-col">
<table width="auto" border="0" cellpadding="0" cellspacing="0" class="rightBox">
<tr>
<td valign="top" class="title">Hot Topic</td>
</tr>
<tr class="topborder">
<td>Only 45 days until race day!</td>
</tr>
<tr>
<td class="topborder"><?php getNews(); ?></td>
</tr>
<tr>
<td class="topborder">Check out photos from our 2004 event!</td>
</tr>
<tr align="center">
<td class="topborder">Race Results<br/><br/>
<table width="130">
<tr>
<td><form name="signup" id="signup" method="post" action="#">
<table width="130" border="0" cellpadding="0" cellspacing="0" class="searchBorder">
<tr>
<td class="title">Results look up</td>
</tr>
<td align="center" valign="top">
<br/>
<br/>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right">Name: </td>
<td align="left"><input size="6" type="text"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input name="submit" type="submit" value="Go" class="button"></td>
</tr>
</table>
<br/>
<br/>
<br/>
</td>
</table>
</form>
</td>
</tr>
</table>
<br>
<tr valign="top">
<td class="topborder">Sign up for our OVT mailing list</td>
</tr>
</table>