scm22ri — 2012-08-21T14:06:48-04:00 — #1
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.
TYPE | timestamp
Default | CURRENT_TIMESTAMP
Attributes | ON UPDATE CURRENT_TIMESTAM
This is what I'm trying to do.
At the below URL their are two users. They each have a favorite number.
hockeyman = 2
coolguy = 3
If hockeyman changes his number to 8
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.
r937 — 2012-08-21T15:13:24-04:00 — #2
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
scm22ri — 2012-08-21T20:01:04-04:00 — #3
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?
"Bob Jones" inputs his info. at this below URL
r937 — 2012-08-21T22:33:28-04:00 — #4
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
scm22ri — 2012-08-22T09:46:53-04:00 — #5
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?
logic_earth — 2012-08-22T09:49:34-04:00 — #6
No, you create a new row in the table.
r937 — 2012-08-22T11:34:09-04:00 — #7
more specifically, using an INSERT statement
system — 2014-10-07T22:49:41-04:00 — #8
This topic is now closed. New replies are no longer allowed.