I don't know how mysql_fetch_array() works. I think you have to handle this
by yourself
by putting something in the loop. You can also make a query for it (SELECT
sum(*) FROM time)


"CÚsar l . aracena" <[EMAIL PROTECTED]> schreef in bericht
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:
<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

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

Reply via email to