I am doing a survey with many pages. Everyone is given the same password to get into the survey (bulk mailing) but since it is to be done anonymously, they have no unique id assigned to them. My problem is that I don't know how to save the data without it (and then select it again). I usually have the following (passcode is the unique number usually assigned to them):
- // Update respondent info
-
mysql_query("UPDATE TABLE SET Q1 ='$Q1' WHERE passcode='{$_SESSION['passcode']}'")
-
or die(mysql_error());
I need to be able to save it to a variable set to the Primary Key. I found this function and it looks like it will work to retrieve the number, but how do I save it as a variable that I can insert into the above code?
- function get_current_insert_id($TEST)
-
{
-
$q = "SELECT LAST_INSERT_ID() FROM $TEST";
-
return mysql_num_rows(mysql_query($q)) + 1;
-
}
I'm not sure if this should under PHP but hopefully someone can help me.
Thanks for taking the time to help me out.