[Tutor] Timer on CGI

Alan Gauld alan.gauld at btinternet.com
Mon Sep 19 23:52:11 CEST 2005


> 1. I want to store the results in a mySQL database - I've done 
> this
> kind of thing before using PHP - are there any good tutorial 
> resources
> for using mysql with python?

There is a generic DB API howto document and I have a database
topic in my tutor which uses SQLite but the basic principles
are identical you just load a different driver...

> 2. Today the children asked if they could be timed when they 
> complete
> the problem. Is there any way of knowing how long they spent
> completing the task?

You should be able to store the time of page display and 
submission
as hidden fields. Javascript might be the easiest way to do this
using the onLoad event. Then get the difference in times when 
they
hit submit and pass the elapsed time as a hidden field for the 
CGI
to pick up and display. Alternatively just pass the onLoad time
when submit is called and do the calculations at the CGI, but
then you get network transit and server queuing times added...

-- 
Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld 





More information about the Tutor mailing list