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:

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

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

// Connect to Database
$db = mysql_connect("localhost", "admin", "xxxxxxxxx");
$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: 
 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>";
<SPAN style="FONT-FAMILY: arial; FONT-SIZE: 14px">Clear the Form?</SPAN> <input 
type="checkbox" value="clear">
<input type="submit" name="submit" value="Refresh">


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
Neuquen, Argentina

Reply via email to