The function selects data from a MySQL db and displays the results in a table.
Here is some of it..
function displayRows()
{
$query_rsQry = "SELECT ID,TITLE,date_format(DATE_CREATED,'%d/%m/%Y') as DATE_CREATED FROM RQF_STORES WHERE EMAIL = '" . $HTTP_SESSION_VARS["userEmail"] . "'";
$orderby = $HTTP_GET_VARS["orderby"];
if ($orderby == "IDASC")
$query_rsQry .= " ORDER BY ID ASC";
elseif ($orderby == "IDDESC")
$query_rsQry .= " ORDER BY ID DESC";
elseif ($orderby == "TITLEASC")
$query_rsQry .= " ORDER BY TITLE ASC";
elseif ($orderby == "TITLEDESC")
$query_rsQry .= " ORDER BY TITLE DESC";
elseif ($orderby == "DATEASC")
$query_rsQry .= " ORDER BY DATE_CREATED ASC";
elseif ($orderby == "DATEDESC")
$query_rsQry .= " ORDER BY DATE_CREATED DESC";
else
$query_rsQry .= " ORDER BY ID ASC";
$maxRows_Recordset1 = 25;
$pageNum_Recordset1 = 0;
if (isset($HTTP_GET_VARS['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $HTTP_GET_VARS['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$query_limit_rsQry = sprintf("%s LIMIT %d, %d", $query_rsQry, $startRow_Recordset1, $maxRows_Recordset1);
$rsQry = mysql_query($query_limit_rsQry, $connection) or die(mysql_error());
$row_rsQry = mysql_fetch_assoc($rsQry);
if (isset($HTTP_GET_VARS['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $HTTP_GET_VARS['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_rsQry);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = (int)($totalRows_Recordset1/$maxRows_Recordset1);
$queryString_Recordset1 = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . implode("&", $newParams);
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="31">
<tr>
<td height="66"><!-- #BeginLibraryItem "/Library/TopLogoBar.lbi" -->
<script language="JavaScript">
<!--
function MM_displayStatusMsg(msgStr) { //v1.0
status=msgStr;
document.MM_returnValue = true;
}
//-->
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="31" bgcolor="#FFFFFF">
<tr>
<td width="35%" height="66"><a href="http://www.hivrdi.org" onMouseOver="MM_displayStatusMsg('RDI - Home');return document.MM_returnValue"><img src="/images/new_logo_s.gif" width="300" height="73" border="0" hspace="5" alt="RDI - HIV Resistance Response Database Initiative"></a></td>
<td height="66" bgcolor="#FFFFFF">
<div align="right"><img src="/images/titlepicbar.jpg" height="55" alt="RDI AIDS HIV Resistance" align="middle" border="0" vspace="5" width="400"><br>
<script language="Javascript1.2">
var now=new Date();
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday",
"Thursday","Friday","Saturday");
var monthname=new Array("January","February","March",
"April","May","June",
"July","August","September",
"October","November","December");
var date = now.getDate();
if (date == 1 || date == 21 || date == 31)
{ ender = "st"}
else
if (date == 2 || date == 22)
{ ender = "nd" }
else
if (date == 3 || date == 23)
{ ender = "rd" }
else
{ ender = "th" }
document.write('<font face=sans-serif size=2 color=#333366>' + weekday[now.getDay()] + ", ");
document.write('<font face=sans-serif size=2 color=#333366>' + now.getDate() + ender + " ");
document.write('<font face=sans-serif size=2 color=#333366>' + monthname[now.getMonth()] + " ");
document.write('<font face=sans-serif size=2 color=#333366>' + now.getFullYear());
document.write('</font></font></font></font>');
</script>
</div>
</td>
</tr>
</table>
<!-- #EndLibraryItem --></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="8" align="center">
<tr>
<td bgcolor="#333366"><!-- #BeginLibraryItem "/Library/MainTopMenu.lbi" --><body onLoad="MM_preloadImages('/images/who_nav_dwn.gif','/images/what_nav_dwn.gif','/images/services_nav_dwn.gif','/images/current_nav_dwn.gif','/images/news_nav_down.gif','/images/science_nav_dwn.gif','/images/funding_nav_down.gif')">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="8" align="center">
<tr>
<td bgcolor="#333366">
<table border="0" cellpadding="0" cellspacing="0" width="600" align="center">
<tr>
<td height="2" width="100">
<div align="center"><a href="/who.htm" target="top" onClick="MM_nbGroup('down','group1','who','/images/who_nav_dwn.gif',1)" onMouseOver="MM_nbGroup('over','who','/images/who_nav_dwn.gif','/images/who_nav_dwn.gif',1);MM_displayStatusMsg('Who we are');return document.MM_returnValue" onMouseOut="MM_nbGroup('out')"><img name="who" src="/images/who_nav_up.gif" border="0" onLoad="" alt="Who we are"></a></div>
</td>
<td height="2" width="10"><img src="/images/divider.gif" width="1" height="20"></td>
<td height="2" width="100">
<div align="center"><a href="/what.htm" target="top" onClick="MM_nbGroup('down','group1','what','/images/what_nav_dwn.gif',1)" onMouseOver="MM_nbGroup('over','what','/images/what_nav_dwn.gif','/images/what_nav_dwn.gif',1);MM_displayStatusMsg('What we do');return document.MM_returnValue" onMouseOut="MM_nbGroup('out')"><img name="what" src="/images/what_nav_up.gif" border="0" onLoad="" alt="What we do"></a></div>
</td>
<td height="2" width="10"><img src="/images/divider.gif" width="1" height="20"></td>
<td height="2" width="91">
<div align="center"><a href="/services.htm" target="top" onClick="MM_nbGroup('down','group1','services','/images/services_nav_dwn.gif',1)" onMouseOver="MM_nbGroup('over','services','/images/services_nav_dwn.gif','/images/services_nav_dwn.gif',1);MM_displayStatusMsg('Services');return document.MM_returnValue" onMouseOut="MM_nbGroup('out')"><img name="services" src="/images/services_nav_up.gif" border="0" onLoad="" alt="Services"></a></div>
</td>
<td height="2" width="10"><img src="/images/divider.gif" width="1" height="20"></td>
<td height="2" width="80">
<div align="center"><a href="/current_activities.htm" target="top" onClick="MM_nbGroup('down','group1','current','/images/current_nav_dwn.gif',1)" onMouseOver="MM_nbGroup('over','current','/images/current_nav_dwn.gif','/images/current_nav_dwn.gif',1);MM_displayStatusMsg('Current Activities');return document.MM_returnValue" onMouseOut="MM_nbGroup('out')"><img name="current" src="/images/current_nav_up.gif" border="0" onLoad="" alt="Current Activities"></a></div>
</td>
<td height="2" width="10"><img src="/images/divider.gif" width="1" height="20"></td>
<td height="2" width="60">
<div align="center"><a href="/news.htm" target="top" onClick="MM_nbGroup('down','group1','news','/images/news_nav_down.gif',1)" onMouseOver="MM_nbGroup('over','news','/images/news_nav_down.gif','/images/news_nav_down.gif',1);MM_displayStatusMsg('News');return document.MM_returnValue" onMouseOut="MM_nbGroup('out')"><img name="news" src="/images/news_nav_up.gif" border="0" onLoad="" alt="News"></a></div>
</td>
<td height="2" width="10"><img src="/images/divider.gif" width="1" height="20"></td>
<td height="2" width="90">
<div align="center"><a href="/scientific_publications.htm" target="top" onClick="MM_nbGroup('down','group1','scientific','/images/science_nav_dwn.gif',1)" onMouseOver="MM_nbGroup('over','scientific','/images/science_nav_dwn.gif','/images/science_nav_dwn.gif',1);MM_displayStatusMsg('Scientific Publications');return document.MM_returnValue" onMouseOut="MM_nbGroup('out')"><img name="scientific" src="/images/science_nav_up.gif" border="0" onLoad="" alt="Scientific Publications"></a></div>
</td>
<td height="2" width="10"><img src="/images/divider.gif" width="1" height="20"></td>
<td height="2" width="80">
<div align="center"><a href="/funding.htm" target="top" onClick="MM_nbGroup('down','group1','funding','/images/funding_nav_down.gif',1)" onMouseOver="MM_nbGroup('over','funding','/images/funding_nav_down.gif','/images/funding