Thanx for the help. I have it almos finished. Now, the script throws all the colums 
for all the rows of the table. My only problem now is how to print the TOTAL for the 
column named time. Can I use mysql_fetch_array() instead of mysql_fetch_row() to 
accomplish this? How can I add it?

Here's what I made so far:

<html>
<head>
 <title>Connection Time</title>
</head>
<body>
<form action="<?php PHP_SELF ?>" method="post">
<?php

if (isset($clear))
{
 $date = "";
 $time = "";
}

// Connect to Database
$db = mysql_connect("localhost", "admin", "xxxxxxxxx");
mysql_select_db("contime");
$query = "select * from time";
$result = mysql_query($query);

// Displays all the rows of the table
while ($row = mysql_fetch_row($result))
{
 foreach ($row as $column)
 {
  echo "<SPAN style=\"FONT-FAMILY: arial; FONT-SIZE: 
14px\">$column&nbsp;&nbsp;&nbsp;</SPAN>";
 }
 echo "<BR>";
}

// Insert new values into the table
if ($time <> "")
{
 $query = "insert into time " . "(date, time) values ('$date', '$time')";
 $result = mysql_query($query);
 $id = mysql_insert_id();
 $message = "Record Added (id = $id)";
}

if (isset($message))
{
 echo "<BR><BR><SPAN style=\"FONT-FAMILY: arial; FONT-SIZE: 14px\">$message</SPAN>";
}
?>
<BR><BR>
<SPAN style="FONT-FAMILY: arial; FONT-SIZE: 14px">Clear the Form?</SPAN> <input 
type="checkbox" value="clear">
<BR><BR>
<input type="submit" name="submit" value="Refresh">

</form>
</body>
</html>

I added the "Clear the Form?" checkbox, so if I refresh using the PHP_SELF won't 
insert the same data again. Is that ok?

Thanx and sorry for the trouble.

Cesar Aracena
[EMAIL PROTECTED]
Neuquen, Argentina

Reply via email to