Hi Eric -
I appreciate your reply, and have tried the behavior, but no dice. I'm attaching the page this displays on, and the code below.
As you can see from the browser page, the row repeat is fine, etc. - the problem now is that each of the documents repeats on each row of the table.
Ideas?
Thanks,
Charles
content.php
<?php require_once('../Connections/CMM.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_DOCUMENTS = 10;
$pageNum_DOCUMENTS = 0;
if (isset($_GET['pageNum_DOCUMENTS'])) {
$pageNum_DOCUMENTS = $_GET['pageNum_DOCUMENTS'];
}
$startRow_DOCUMENTS = $pageNum_DOCUMENTS * $maxRows_DOCUMENTS;
mysql_select_db($database_CMM, $CMM);
$query_DOCUMENTS = "SELECT * FROM DOC_UPLOADS";
$query_limit_DOCUMENTS = sprintf("%s LIMIT %d, %d", $query_DOCUMENTS, $startRow_DOCUMENTS, $maxRows_DOCUMENTS);
$DOCUMENTS = mysql_query($query_limit_DOCUMENTS, $CMM) or die(mysql_error());
$row_DOCUMENTS = mysql_fetch_assoc($DOCUMENTS);
if (isset($_GET['totalRows_DOCUMENTS'])) {
$totalRows_DOCUMENTS = $_GET['totalRows_DOCUMENTS'];
} else {
$all_DOCUMENTS = mysql_query($query_DOCUMENTS);
$totalRows_DOCUMENTS = mysql_num_rows($all_DOCUMENTS);
}
$totalPages_DOCUMENTS = ceil($totalRows_DOCUMENTS/$maxRows_DOCUMENTS)-1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Table Content</title>
<style type="text/css">
<!--
.SMALL_TEXT {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: .8em;
line-height: 2em;
}
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="100%" class="SMALL_TEXT">
<tr>
<td>DOCUMENT NAME</td>
<td>DOCUMENT</td>
<td>UPLOAD DATE</td>
<td>FIRST NAME</td>
<td>LAST NAME</td>
<td>DEPARTMENT</td>
<td>CATEGORY</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_DOCUMENTS['DOCNAME']; ?></td>
<td><?
$path = "UPLOADED DOCUMENTS";
$dir_handle = @opendir($path) or die("Unable to open $path");
echo "Directory Listing of $path<br/>";
while($file = readdir($dir_handle)) {
if(is_dir($file)) {
continue;
}
else if($file != '.' && $file != '..') {
echo "<a href='plugins/$path/$file'>$file</a><br/>";
}
}
//closing the directory
closedir($dir_handle);
?></td>
<td><?php echo $row_DOCUMENTS['UPLOAD_DATE']; ?></td>
<td><?php echo $row_DOCUMENTS['FNAME']; ?></td>
<td><?php echo $row_DOCUMENTS['LNAME']; ?></td>
<td><?php echo $row_DOCUMENTS['DEPARTMENT']; ?></td>
<td><?php echo $row_DOCUMENTS['CATEGORY']; ?></td>
</tr>
<?php } while ($row_DOCUMENTS = mysql_fetch_assoc($DOCUMENTS)); ?>
</table>
</form>
</body>
</html>
<?php
mysql_free_result($DOCUMENTS);
?>