每次用户创建考试时,我想插入一个连续的项目编号。每次他创建考试时,它都会重新开始为 1。我非常需要你的帮助,人们。更多的权力。:)
这是我的代码:
$examid = $_SESSION['examid'];
$itemnum = 1;
$sql = mysql_query("INSERT INTO exam_questions (question_description, question_type, question_exam_id) VALUES ('$question', '$type', '$examid')")or die(mysql_error());
$lastinsertid = mysql_insert_id();
mysql_query("UPDATE exam_questions SET question_set_id='<??????????>' WHERE question_id='$lastinsertid' LIMIT 1")or die(mysql_error());