Hi guys,

 

I am very new to using PHP and am working on my first site so I'm sorry
if this question is trivial.  I have created a table that returns the
first row from a table.  It has the date in the first column and then
five more columns with numbers.  I would like to get the sum of those
five columns.  Any help would be greatly appreciated!

 

I'm pasting my code below.

 

Thank you.

Kevin

 

All my code.  Generated with Dreamweaver...

 

 

 

<?php require_once('Connections/connExchangeDB.php'); ?>

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "",
$theNotDefinedValue = "") 

{

  $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_Edrive = 1;

$pageNum_Edrive = 0;

if (isset($_GET['pageNum_Edrive'])) {

  $pageNum_Edrive = $_GET['pageNum_Edrive'];

}

$startRow_Edrive = $pageNum_Edrive * $maxRows_Edrive;

 

mysql_select_db($database_connExchangeDB, $connExchangeDB);

$query_Edrive = "SELECT servers.`Date`, servers.exchangemb1e,
servers.exchangemb2e, servers.exchangemb3e, servers.exchangemb4e,
servers.exchangemb5e FROM servers ORDER BY servers.`Date` DESC";

$query_limit_Edrive = sprintf("%s LIMIT %d, %d", $query_Edrive,
$startRow_Edrive, $maxRows_Edrive);

$Edrive = mysql_query($query_limit_Edrive, $connExchangeDB) or
die(mysql_error());

$row_Edrive = mysql_fetch_assoc($Edrive);

 

if (isset($_GET['totalRows_Edrive'])) {

  $totalRows_Edrive = $_GET['totalRows_Edrive'];

} else {

  $all_Edrive = mysql_query($query_Edrive);

  $totalRows_Edrive = mysql_num_rows($all_Edrive);

}

$totalPages_Edrive = ceil($totalRows_Edrive/$maxRows_Edrive)-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";><!-- InstanceBegin
template="Templates/template.dwt.php" codeOutsideHTMLIsLocked="false"
-->

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!-- InstanceBeginEditable name="doctitle" -->

<title>Exchange at BNL - Todays Disk Usage</title>

<!-- InstanceEndEditable -->

<!-- InstanceBeginEditable name="head" -->

<style type="text/css">

<!--

.style3 {font-size: x-small}

-->

</style><!-- InstanceEndEditable -->

<link href="twoColLiqLtHdr.css" rel="stylesheet" type="text/css" />

<!--[if IE]>

<style type="text/css"> 

/* place css fixes for all versions of IE in this conditional comment */

.twoColLiqLtHdr #sidebar1 { padding-top: 30px; }

.twoColLiqLtHdr #mainContent { zoom: 1; padding-top: 15px; }

/* the above proprietary zoom property gives IE the hasLayout it needs
to avoid several bugs */

</style>

<![endif]-->

<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>

<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet"
type="text/css" />

<style type="text/css">

ul.MenuBarVertical

{

                margin: 0 auto ;

                width: 8em;

}

</style>

 

</head>

 

<body class="twoColLiqLtHdr">

 

<div id="container"> 

  <div id="header">

    <h1 align="center">Exchange</h1>

    <!-- end #header --></div>

  <div id="sidebar1">

    <ul id="MenuBar1" class="MenuBarVertical">

      <li><a href="index.php">Home</a> </li>

      <li><a href="#" class="MenuBarItemSubmenu">Disk Usage</a>

        <ul>

          <li><a href="current.php">Current Stats</a></li>

          <li><a href="MaxDays.php">Historical</a></li>

        </ul>

      </li>

    </ul>

    <p>&nbsp;</p>

  </div>

  <div id="mainContent"><!-- InstanceBeginEditable name="Body" -->

    <div align="center">

      <h4>Total Disk Usage Of All Databases by Server (GB)</h4>

    </div>

    <table border="1" align="center">

    <tr>

      <td><div align="center"><span
class="style3"><strong>Date</strong></span></div></td>

      <td><span class="style3"><strong>exchangemb1e</strong></span></td>

      <td><span class="style3"><strong>exchangemb2e</strong></span></td>

      <td><span class="style3"><strong>exchangemb3e</strong></span></td>

      <td><div align="center"><span
class="style3"><strong>exchangemb4e</strong></span></div></td>

      <td><span class="style3"><strong>exchangemb5e</strong></span></td>

    </tr>

    <?php do { ?>

      <tr>

        <td><div align="center"><span class="style3"><?php echo
$row_Edrive['Date']; ?></span></div></td>

        <td><div align="center"><span class="style3"><?php echo
$row_Edrive['exchangemb1e']; ?></span></div></td>

        <td><div align="center"><span class="style3"><?php echo
$row_Edrive['exchangemb2e']; ?></span></div></td>

        <td><div align="center"><span class="style3"><?php echo
$row_Edrive['exchangemb3e']; ?></span></div></td>

        <td><div align="center"><span class="style3"><?php echo
$row_Edrive['exchangemb4e']; ?></span></div></td>

        <td><div align="center"><span class="style3"><?php echo
$row_Edrive['exchangemb5e']; ?></span></div></td>

      </tr>

      <?php } while ($row_Edrive = mysql_fetch_assoc($Edrive)); ?>

 

 </table>

  <!-- InstanceEndEditable --></div>

                <!-- This clearing element should immediately follow the
#mainContent div in order to force the #container div to contain all
child floats --><br class="clearfloat" />

  <div id="footer">

    <p><a href="index.php"><img src="images/exchange_logo.JPG" alt="Home
Page" width="48" height="41" border="0" /></a></p>

  <!-- end #footer --></div>

<!-- end #container --></div>

<script type="text/javascript">

<!--

var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1",
{imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});

//-->

</script>

</body>

<!-- InstanceEnd --></html>

<?php

mysql_free_result($Edrive);

?>



[Non-text portions of this message have been removed]

Reply via email to