note 83869 deleted from function.mssql-query by cmb
| From: | cmb@php.net | Date: | Sun, 23 Jun 2019 14:21:16 +0000 |
| Subject: | note 83869 deleted from function.mssql-query by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211367@lists.php.net to get a copy of this message | ||
Note Submitter: orbex1 at gmail dot com
----
Hopes this saves somebody the hassle I had to go through...
Was struggling with an M$sql database which was poorly designed (no Identity-colums), so I had to
find a way to get the last id inserted...
Also struggled with the chars a while ;-)
$sql = "SELECT cast(AD_GUID as varchar(36)) FROM test_adres;";
//execute the SQL query and return records to find insertID
$result = mssql_query($sql) or die("MS-Query Error in select-query");
$max = (mssql_num_rows($result)-1);
mssql_data_seek($result, $max);
$row = mssql_fetch_row($result);
$insert_id = $row[0];
Hope this will help somebody in the future...