My problem is this. I need to update a record that has been created very recently. I know the user's userid only. However in this table that i need to use the user may have several entries with his userid. The primary key is the quizid. The primary key auto increments, and as well when each record is created or modified it has a timestamp.
I need to use the userid to somehow find the latest record for that user and update it from time to time as they are answering a quiz. The quiz has a question 1 per page. So i will need to update as i go along. I thought the sql statement would look something like this:
$query = 'UPDATE hpquiz SET q1 = "1" WHERE userid = "'.$userhp123.'" AND max(createdate)';
//execute query
$result = mysql_query($query) or die('Query failed: '. mysql_error());
Somebody told me you can use this max() function to help get the latest record. I suppose I could also do a max(quizid) as well. But nothing appears to work.
Help