我做错了什么,我试图从表中获取最后一个record_id,在第一条语句将它插入我的表之后。我似乎只是打印用于显示最后一个 id 的代码?
SELECT CURRVAL (pg_get_serial_sequence('sheet_tbl','sheet_id'))";
代码在这里
else {
echo 'Record added';
$sql = "INSERT INTO sheet_tbl (site_id, eventdate, eventtime, username, additionalvolunteers) VALUES ('$_POST[site_id]','$_POST[eventdate]','$_POST[eventtime]', '$username','$_POST[additionalvolunteers]')";
echo $sql; //Just so I can see what is getting sent
$result = pg_query($sql);
$sheet_id_pull = "SELECT CURRVAL (pg_get_serial_sequence('sheet_tbl','sheet_id'))";
echo $sheet_id_pull; //This is where im having the issue with the above line.
}