<html>
<!-- BEGIN WEBMAIL STATIONERY -->
<head></head>
<body>
<!-- WEBMAIL STATIONERY noneset -->
<DIV></DIV>
<P>I thought about checking into it for you, but I haven't really figured out a reason to use triggers yet. I seem to be able to do the same things using stored procedures, such as checking another table before doing an insert, update or delete to see if a certain condition is true or false. I like being able to do this stuff inside the database instead of making a bunch of diffent PHP queries. It seems to take less typing to do it all in a stored procedure. I'm glad you figured it out. I bought a good book, if you're interested, "MySQL Store Procedure Programming" by O'Reilly, ISBN 0-596-10089-2. It also has a chapter on triggers.</P>
<P> </P>
<P>Carl Olsen</P>
<P><A href="http://www.carl-olsen.com/">http://www.carl-olsen.com/</A></P>
<P><BR> </P>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">-------------- Original message from "Kevin C. Smith" <kevin@linuxsmith.com>: -------------- <BR><BR><BR>> Since I got no response I thought some might be interested in the solution. <BR>> After reading the docs it turns out to be fairly simple. Yes, I didn't <BR>> read the docs before; I was trying speed it up by getting pointed to <BR>> the TIMEDIFF function. To get the time difference of two fields using a <BR>> trigger. <BR>> <BR>> CREATE TRIGGER trigger_time BEFORE INSERT ON time_table FOR EACH ROW SET <BR>> NEW.time_diff = TIMEDIFF(NEW.end_time, NEW.begin_time); <BR>> <BR>> Of course an ON UPDATE trigger is also needed. <BR>> <BR>> <BR>> -- <BR>> Kevin C. Smith <BR>> <BR>> _______________________________________________ <BR>> Cialug mailing list <BR>> Cialug@cialug.org <BR>> http://cialug.org/mailman/listinfo/cialug </BLOCKQUOT
E>
<!-- END WEBMAIL STATIONERY -->
</body>
</html>