Log Application Formatting Issue...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	I am trying to tweak an application that I have developed.  The
application is our "On-Call Log".  This application consists of three pages;
one page to input new entries, one page to edit existing entries, and
finally a log view page.  The log view page displays all entries for the
past 5 days.  The display of the entries is formatted properly, and
presented chronologically with the oldest first with 10 items per page.
This is exactly what I want.  The one thing that I want to change is that
the log defaults to displaying the "first" page containing the oldest items.
I would like the log to display exactly as it does, but default to
displaying the last page first.  This way we see the most recent items
first.
	I hope this makes sense, and following is what I think are the
relevant sections of the code:

{ some code snipped }
mysql_select_db($database, $Prod);
$query_entry = "SELECT * FROM oncall WHERE TO_DAYS(NOW()) - TO_DAYS(ptime)
<=5 ORDER BY 'ptime' ASC";
$query_limit_entry = sprintf("%s LIMIT %d, %d", $query_entry,
$startRow_entry, $maxRows_entry);
$entry = mysql_query($query_limit_entry, $Prod) or die(mysql_error());
$row_entry = mysql_fetch_assoc($entry);

if (isset($HTTP_GET_VARS['totalRows_entry'])) {
  $totalRows_entry = $HTTP_GET_VARS['totalRows_entry'];
} else {
  $all_entry = mysql_query($query_entry);
  $totalRows_entry = mysql_num_rows($all_entry);
}
$totalPages_entry = ceil($totalRows_entry/$maxRows_entry)-1;

	{ Not completely sure what following section does.  }

$queryString_entry = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_entry") == false && 
        stristr($param, "totalRows_entry") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_entry = "&" . implode("&", $newParams);
  }
}
$queryString_entry = sprintf("&totalRows_entry=%d%s", $totalRows_entry,
$queryString_entry);
?>
	{ I know that this has to do with handling the log page numbering,
but fuzzy on the details.  }

{  some html formatting snipped  }

  <?php do { 
    if ($row_entry['P1']) { ?>
  <tr> 
    <td height="23" bgcolor="#FAADBC"> 
      <div align="center"><a href="oncall_update.php?callid=<?php echo
$row_entry['callid']; ?>"><?php echo $row_entry['callid']; ?></a></div></td>
    <td valign="top" bgcolor="#FAADBC"><?php echo $row_entry['sa']; ?></td>
    <td valign="top" bgcolor="#FAADBC"><?php echo $row_entry['ptime'];
?></td>
    <td valign="top" bgcolor="#FAADBC"><div align="center"><?php echo
$row_entry['system']; ?></div></td>
    <td valign="top" bgcolor="#FAADBC"><?php echo $row_entry['name'];
?></td>
    <td valign="top" bgcolor="#FAADBC"><?php echo $row_entry['problem'];
?></td>
    <td valign="top" bgcolor="#FAADBC"><?php echo $row_entry['resolution'];
?></td>
  </tr>
  <?php } else { ?>
    <tr> 
    <td height="23" bgcolor="#CCCCCC"> 
      <div align="center"><a href="oncall_update.php?callid=<?php echo
$row_entry['callid']; ?>"><?php echo $row_entry['callid']; ?></a></div></td>
    <td valign="top" bgcolor="#CCCCCC"><?php echo $row_entry['sa']; ?></td>
    <td valign="top" bgcolor="#CCCCCC"><?php echo $row_entry['ptime'];
?></td>
    <td valign="top" bgcolor="#CCCCCC"><div align="center"><?php echo
$row_entry['system']; ?></div></td>
    <td valign="top" bgcolor="#CCCCCC"><?php echo $row_entry['name'];
?></td>
    <td valign="top" bgcolor="#CCCCCC"><?php echo $row_entry['problem'];
?></td>
    <td valign="top" bgcolor="#CCCCCC"><?php echo $row_entry['resolution'];
?></td>
  </tr>
  <?php } ?>
{  Snipped the rest  }

	I am using DreamWeaver MX, so some of this code may be a little
strange.  This is also the reason why I am a bit confused by some of what is
goign on in the page.  Thanks in advance for the help.


Scott Nipp
Phone:  (214) 858-1289
E-mail:  sn4265@sbc.com
Web:  http:\\ldsa.sbcld.sbc.com



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux