phpmyadmin with NOW() timestamp field

  • Follow


I have a MySQL database that include a timestamp field, designed to set 
to NOW() whenever I update another field in that record (updates are 
done manually by me, using phpmyadmin).

The purpose of this database is to track some fundraising a group I'm in 
does, so the updates are typically when a donor sends a contribution in, 
and the purpose of the timestamp field is to show when each donor's last 
contribution was recorded.

I'd like to NOT have the timestamp field update sometimes, for example, 
if I'm merely changing someone's email address or mailing address - 
really, anything not related to them making a donation.

However, even though I used to know how to do this, I've forgotten.  
What I *think* I should be doing is, when updating a record, use the 
pulldown menu under "function" for the datestamp field, and change it 
from NOW to the blank entry.  But this doesn't work.  I do this, and the 
field updates to the NOW function (i.e., current date/time stamp).

So now I wind up copying the correct date/time using CTRL/C in the 
timestamp field, updating the field(s) I want to update, saving the 
changes, then having to go back in, paste the correct date/time back 
into the timestamp field, save that, and then it's correct.

What SHOULD I be doing?  Again, I want a way to update one or more 
fields in a record using phpmyadmin, but WITHOUT having the 
timestamp/NOW field changing from its previous setting.
0
Reply MozillaJoe 4/25/2007 1:26:48 AM

MozillaJoe wrote:
> I have a MySQL database that include a timestamp field, designed to set 
> to NOW() whenever I update another field in that record (updates are 
> done manually by me, using phpmyadmin).
> 
> The purpose of this database is to track some fundraising a group I'm in 
> does, so the updates are typically when a donor sends a contribution in, 
> and the purpose of the timestamp field is to show when each donor's last 
> contribution was recorded.
> 
> I'd like to NOT have the timestamp field update sometimes, for example, 
> if I'm merely changing someone's email address or mailing address - 
> really, anything not related to them making a donation.
> 
> However, even though I used to know how to do this, I've forgotten.  
> What I *think* I should be doing is, when updating a record, use the 
> pulldown menu under "function" for the datestamp field, and change it 
> from NOW to the blank entry.  But this doesn't work.  I do this, and the 
> field updates to the NOW function (i.e., current date/time stamp).
> 
> So now I wind up copying the correct date/time using CTRL/C in the 
> timestamp field, updating the field(s) I want to update, saving the 
> changes, then having to go back in, paste the correct date/time back 
> into the timestamp field, save that, and then it's correct.
> 
> What SHOULD I be doing?  Again, I want a way to update one or more 
> fields in a record using phpmyadmin, but WITHOUT having the 
> timestamp/NOW field changing from its previous setting.

Actually, I would think you would want to track all of the donations 
instead of just the last one.

For instance, another table with the donor id, amount and timestamp. 
This would be separate from the rest of the info.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
0
Reply Jerry 4/25/2007 2:47:14 AM


In article <8eydndQMRKSnLrPbnZ2dnUVZ_uPinZ2d@comcast.com>,
   Jerry Stuckle <jstucklex@attglobal.net> wrote:

> Actually, I would think you would want to track all of the donations 
> instead of just the last one.

> For instance, another table with the donor id, amount and timestamp. 
> This would be separate from the rest of the info.

I wanted to do something vaguely remeniscent of this a while back, but
never actually got around to it. I wondered whether it would be
possible/sensible to use the timestamp as (part of) the key?

Dave

-- 
Dave Stratford    ZFCA
http://daves.orpheusweb.co.uk/
Hexagon Systems Limited - Experts in VME systems development

0
Reply Dave 4/25/2007 7:08:29 AM

In article <8eydndQMRKSnLrPbnZ2dnUVZ_uPinZ2d@comcast.com>,
 Jerry Stuckle <jstucklex@attglobal.net> wrote:

> Actually, I would think you would want to track all of the donations 
> instead of just the last one.
> 
> For instance, another table with the donor id, amount and timestamp. 
> This would be separate from the rest of the info.

Well, if it helps you answer my original question, I have fields _2007, 
_2006, _2005, etc., for each calendar year, and those fields hold the 
total donations someone made for that year.

There is another field, last_donation_date, type timestamp, that I have 
showing the last time a donation was recorded for that person - 
obviously, someone who gave on 12/31/2006 wouldn't want to receive a 
fundraising appeal in January 2007, whereas someone who gave in 1/06 
would be ready for a new appeal 12 months later.

So, to my original question:  How, using phpmyadmin, can I update a 
field or fields in a record, without having a timestamp field update as 
well (i.e., the value in the timestamp field remains unchanged)?
0
Reply MozillaJoe 4/25/2007 11:10:48 AM

MozillaJoe wrote:
> In article <8eydndQMRKSnLrPbnZ2dnUVZ_uPinZ2d@comcast.com>,
>  Jerry Stuckle <jstucklex@attglobal.net> wrote:
> 
>> Actually, I would think you would want to track all of the donations 
>> instead of just the last one.
>>
>> For instance, another table with the donor id, amount and timestamp. 
>> This would be separate from the rest of the info.
> 
> Well, if it helps you answer my original question, I have fields _2007, 
> _2006, _2005, etc., for each calendar year, and those fields hold the 
> total donations someone made for that year.
> 
> There is another field, last_donation_date, type timestamp, that I have 
> showing the last time a donation was recorded for that person - 
> obviously, someone who gave on 12/31/2006 wouldn't want to receive a 
> fundraising appeal in January 2007, whereas someone who gave in 1/06 
> would be ready for a new appeal 12 months later.
> 
> So, to my original question:  How, using phpmyadmin, can I update a 
> field or fields in a record, without having a timestamp field update as 
> well (i.e., the value in the timestamp field remains unchanged)?

That's a terrible design.

You should redesign your database (Google for "database normalization") 
then write a application to access it.  It's not that hard.

But for the way you're doing it, you might as well use an Excel 
spreadsheet.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
0
Reply Jerry 4/25/2007 12:38:22 PM

4 Replies
317 Views

(page loaded in 0.071 seconds)

Similiar Articles:







7/24/2012 5:54:06 PM


Reply: