我有一个带ID的表,这个ID是自动增量和主键,我第一次插入到该表时,ID从0开始,但在我从该表中删除所有值并再次插入它之后,ID不会从0开始,但是从ID的最后一个值开始,出了什么问题?我可以将值重置为0吗?
我想用java将结果写到文件的末尾
FileWriter fStream;
try {
fStream = new FileWriter("recallPresision.txt", true);
fStream.append("queryID=" + queryID + " " + "recall=" + recall + " Pres=" + presision);
fStream.append("\n");
fStream.flush();
fStream.close();
} catch (IOException ex) {
Logger.getLogger(query.class.getName()).log(Level.SEVERE, null, ex);
}
Run Code Online (Sandbox Code Playgroud)
我"\n"在声明中写道,它写入文件但不是新行
我想用新行打印结果
我有一个关于MySQL的表与主键,我插入到该表,我想恢复已插入的最后一行的ID,我知道我必须使用LAST_INSERT_ID
但我的问题是在使用该语句后将值插入另一个表没有主键,我可以再次使用它来获取第一个插入的确切ID吗?
$ php pdo#
include_once 'type_model.php';
$t = new Type_Model();
$typeID = $t->getTypeID($type);
include_once 'informationObject_model.php';
$i = new InformationObject_Model();
$answerIoID = $i->getIOID($ioAnswer);
$query = "INSERT INTO question (info, text, answer, answerIoID, firstChoice, secondChoice, thirdChoice,
firstHint, secondHint, typeID) VALUES (:info, :text, :answer, :answerIoID,
:firstChoice, :secondChoice, :thirdChoice, :firstHint, :secondHint, :typeID)";
$sth = $this->db->prepare($query);
$sth->execute(array(
':info' => $info,
':text' => $text,
':answer' => $answer,
':answerIoID' => $answerIoID,
':firstChoice' => $choices[0],
':secondChoice' => $choices[1],
':thirdChoice' => $choices[2],
':firstHint' => $hints[0],
':secondHint' => …Run Code Online (Sandbox Code Playgroud)