create a trigger for update field

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 ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-06-2008
micky
 
Posts: n/a
Default create a trigger for update field

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
Reply With Quote
  #2 (permalink)  
Old 07-06-2008
Michael Austin
 
Posts: n/a
Default Re: create a trigger for update field

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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:37 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0