私はこの方法を試しました:
$result = odbc_exec($connection, 'SELECT id FROM MyTable WHERE id = @@Identity');
しかし、それは私に与えます
構文エラー: 予期しない T_VARIABLE
編集:あなたの助けのおかげで、ここに完全なロジックがあります:
$result = odbc_exec($connection, 'INSERT data into the table;SELECT SCOPE_IDENTITY() AS id;');
$row = odbc_fetch_array($result); //this line gives the error!
$id = $row['id'];
edit2:「;」を見逃しました =_=
とにかくscope_identityは機能しません:
このインデックスで利用できるタプルはありません
fetcharray 呼び出し時