Hi again.

As I mentioned before, I am trying out my first script. Here it is, so anyone who 
wants can tell me where my errors are:

<?php
// Connect to Database
$db = mysql_connect("localhost", "admin", "xxxxxxx");
mysql_select_db("contime");
$query = "select * from time where id > 0";
$result = mysql_query($query);
$row = mysql_fetch_row($result);

function totalsum()
 {
  if($row[2] > 0)
   {
    $totalsum1 = sum($row[2]);
    echo $totalsum;
   }
 }

if ($row[0] > 0)
 {
  $id  = $row[0];
  $date = $row[1];
  $time = $row[2];
 
  echo $row[0] . " " . $row[1] . " " . $row[2];
  echo "<BR><BR>";
  echo "<B>Total:</B>";
  echo totalsum();
 }

?>

As I mentioned in a past mail, the purpose of this script, is to manage values sent 
from a form, with the current date and the total amount of time I spent on my Dial Up 
connection. Then it should display the last 30 days connections (not implemented yet) 
and a total of the connection time (which isn't working) for those days or current 
month.

Actually it displays only the first one of the records and doesn't display the total. 
Can anybody help me out here? I know it's just a try, but it's very important for my 
learning in order to see what I'm missing here.

Thanx in advance.

Cesar Aracena

Reply via email to