Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

MySQL triggers 29 Jul 2012 08:25 #2920

I would like to record automatically a datetime record in one of my SQL table when another field of the same table is changed by the front-end user.
I guess this is usually realized using SQL triggers.

1 => Where in j-cook interface can I define such triggers ?
2 => If it's not possible from the interface where should be the right place in the generated code to do it ?

Please Log in or Create an account to join the conversation.

Last edit: by admin.

Re: MySQL triggers 30 Jul 2012 16:57 #2928

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
You can use the 'Creation date' wizard.

If you want to use a different way :


MySQL has an issue here :
stackoverflow.com/questions/168736/how-d...ysql-datetime-column

You can realize it with two methods.


1st Method (Triggers)
TODO in :
sql/install.mysql.utf8.sql

Add the SQL instructions at the installation (like triggers)


2nd Method
TODO in :
tables/[myTable].php

in the check() function :

Test the value and if the value is empty, fill it with the current time (PHP call)
mktime()
or
www.php.net/manual/fr/function.date.php#...unction.date-seealso
Hope it helps
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Last edit: by admin.
  • Page:
  • 1
Time to create page: 0.075 seconds

Real time saver and great Component Builder tool ! I have been developing with J-Cook Pro Component Builder for several months now and can say with all honesty that this product/service is second to none. The product is feature rich and is being improved and added to all the time. Do yourself a favor if you need to build a Joomla! Component then you can do no wrong in trying the product. You will save on time and effort while being able to deliver your project on time. J-Cook pro does the hard work for you you then have the freedom to fully customise the end result for your own needs. 

One word: Awesome.
Edwardcox (JED)
         

Get Started