This is a discussion on create a trigger for update field within the MySQL Database forums, part of the Database Forums category; I've a member table with a field named lastvisit (type int) that contain values like 1215285455 that I've ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I've a member table with a field named
lastvisit (type int) that contain values like 1215285455 that I've a credit field (type int) I would like to create a new trigger that add 1 value in credit field each time that a user enter in the site.... please note that I've to add 1 only one time per day if today I enter 3 time I want only add one value in credit field Can you help me?? I can also create new temp field for manage this information thanks |
|
|||
|
micky wrote:
> I've a member table with a field named > > lastvisit > > (type int) > > that contain values like 1215285455 > > that I've a credit field (type int) > > I would like to create a new trigger that add 1 value in credit field > each time that a user enter in the site.... please note that I've to add > 1 only one time per day > > if today I enter 3 time I want only add one value in credit field > > Can you help me?? > > I can also create new temp field for manage this information > > thanks so, how does it know that this particular user entered today or 5 days ago? If all you have is adding 1 to the credit field - there is no way unless this table or some other table that can be joined to this table also contains a lastvisit date. Now you can search the docs for examples for a trigger on how it can check to see if the old last visit date does or does not equal the new date then update the credit field. Should be quite trivial. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|