Storing numerical data as a timestamp?

Hi Everyone,

I’m trying to figure out how to properly configure my mysql database to store numbers as a timestamp. I don’t believe this is the correct way to do so. I tried changing the TYPE to VARCHAR but I get a mysql error. The below URL is where I want my user to input information.

Column
TYPE | timestamp
Default | CURRENT_TIMESTAMP
Collation
Attributes | ON UPDATE CURRENT_TIMESTAM
Null
Auto_Increment
Comments

http://whatsmyowncarworth.com/auto-members/math/math.php

>>>>>>>>>>

This is what I’m trying to do.

At the below URL their are two users. They each have a favorite number.

http://www.whatsmyowncarworth.com/auto-practice/display-member-info.php
hockeyman = 2
coolguy = 3

If hockeyman changes his number to 8
and
coolguy changes his number is 12

Using a timestamp what’s the best way to store the old numbers of 2/3? while keeping the new numbers of 8/12.

Thanks everyone!

you lost me right here

why would you want to store a number as a timestamp?

i went to your math.php page and it made no sense whatsoever

also, this –

what’s the best way to store the old numbers of 2/3? while keeping the new numbers of 8/12
did not make sense either

i’m pretty good with mysql, but in this case, the requirements have got me completely stymied

Hi R937,

My mistake. I gave the wrong URL and worded my question improperly. This is what I meant.

This is what I’m attempting to do. I want to store numbers for each user in a mysql table.

Let’s say for example user “bob jones” inputs his favorite number of 2 @ 2012-08-21 18:24:45. Then one day later he then changes his fav number to 5. How would I store/keep his first number of 2 and also 5 in a mysql table?

http://whatsmyowncarworth.com/auto-members/timestamp/display-timestamp-data.php

“Bob Jones” inputs his info. at this below URL
http://whatsmyowncarworth.com/auto-members/timestamp/timestamp.php

Thanks!

by simply inserting each of his choices in the table, along with the timestamp of when he chose it

a 3-column table will do it – userid, chosen_number, datetime_chosen

if you want to see his current choice, just run a query with ORDER BY date_chosen DESC LIMIT 1

gangnam style :wink:

Hi r937,

Thanks for the reply. I have a few questions.

In your process wouldn’t I need to create a new table every-time a user inputs a new favorite number?

The reason why I ask is because what if user “bob jones” wants to add 15, 25 or 125 new favorite numbers. Wouldn’t each new favorite number need a new table?

Thanks!

No, you create a new row in the table.

more specifically, using an INSERT statement