【发布时间】:2015-03-07 20:10:21
【问题描述】:
我正在使用此代码将新记录插入数据库:
function newProtocol($date, $type, $text, $who, $reff) {
$sql = "INSERT INTO c_rozhovor (ref_kunde, protokol_typ, besuch_protokol, datum_vzniku, kto_vytvoril) VALUES ('"
.msescape($reff)."','"
.msescape($type)."','"
.msescape($text)."','"
.msescape($date)."','"
.msescape($who)."')";
$connection = odbc_connect(constant('DATABASE_NAME'),'','');
if (!connection) return false;
$query = odbc_exec($connection, $sql);
if (!query) return false;
return "New protocol was successfuly saved!";
}
我想以某种方式返回 最后插入的 id 而不是 New protocol was successfully saved! 字符串。 MySql 中的 LAST_INSERT_ID() 之类的东西。有没有办法在 SQL Server 2000 中实现这一点?
【问题讨论】:
标签: sql-server odbc sql-server-2000 lastinsertid last-insert-id