473,386 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Update changes values I want kept

17
I have a table I create using:
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE  `biuproj`.`quiz_taken` (
  2.   `quizid` int(10) unsigned NOT NULL,
  3.   `studentid` int(10) unsigned NOT NULL,
  4.   `starttime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  5.   `endtime` timestamp NOT NULL default '0000-00-00 00:00:00',
  6.   PRIMARY KEY  (`quizid`,`studentid`)
  7. );
  8.  
I then add the values (2,111222,NOW(),0) to it.

At the end I would like to change the `endtime` field to view the current time (after some time has elapsed, meaning starttime and endtime will be different).
However, when I run the query:
update quiz_taken SET endtime=NOW() where quizid=2 and studentid=111222

It also changet the starttime to view the new time...

What am I doing wrong?
Sep 11 '08 #1
3 1666
r035198x
13,262 8TB
Why do you have
Expand|Select|Wrap|Line Numbers
  1. on update CURRENT_TIMESTAMP
on it's definition and what do you think it does?
Sep 11 '08 #2
scf1984
17
Well, I'm using MySQL Query Browser, which added that thing automatically.

I changed the CREATE statement to:

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE  `biuproj`.`quiz_taken` (
  2.   `quizid` int(10) unsigned NOT NULL,
  3.   `studentid` int(10) unsigned NOT NULL,
  4.   `starttime` timestamp NOT NULL default '0000-00-00 00:00:00',
  5.   `endtime` timestamp NOT NULL default '0000-00-00 00:00:00',
  6.   PRIMARY KEY  (`quizid`,`studentid`)
  7. );
And it works fine now.
Thanks! :D
Sep 11 '08 #3
Atli
5,058 Expert 4TB
scf1984,

Please use [code] tags when posting your code examples.

Thanks you
MODERATOR
Sep 11 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jaunty Edward | last post by:
HI, I have to write secure update record php script, here are the complete details of the website, the website has a login system that authenticates the user, writes the session ID for username...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
18
by: Bill Smith | last post by:
The initial row is inserted with the colPartNum column containing a valid LIKE pattern, such as (without the single quotes) 'AB%DE'. I want to update the column value with the results of a query...
0
by: EKL | last post by:
Hi, I'm making a sort of Customer and Orders database in MS Access 2003. My problem is that I wish to update the table "tblTransaction" based on changes made in the table "tblOrderDetails"....
4
by: Jonathan Upright | last post by:
Greetings to anyone who can help: I'm using WebMatrix to make ASP.NET pages, and I chose the "Editable DataGrid" at the project selector screen. As you may know, it defaults to the Microsoft...
15
by: graham | last post by:
Hi all, <bitching and moaning section> I am asking for any help I can get here... I am at the end of my tether... I don;t consider myself a genius in any way whatsoever, but I do believe I have...
4
by: Irfan | last post by:
hi, all Two question: 1. When a row is deleted or added (or in other words when there is change) in the datagrid, Is this change actually the change in the underlying dataset ? 2. which...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.