note 83869 added to function.mssql-query
| From: | orbex1atgmaildotcom at osu1 dot php dot net | Date: | Mon, 16 Jun 2008 12:16:22 +0000 |
| Subject: | note 83869 added to function.mssql-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140494@lists.php.net to get a copy of this message | ||
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...
----
Server IP: 83.137.20.135
Probable Submitter: 92.66.42.33
----
Manual Page -- http://www.php.net/manual/en/function.mssql-query.php
Edit -- https://master.php.net/note/edit/83869
Del: integrated -- https://master.php.net/note/delete/83869/integrated
Del: useless -- https://master.php.net/note/delete/83869/useless
Del: bad code -- https://master.php.net/note/delete/83869/bad+code
Del: spam -- https://master.php.net/note/delete/83869/spam
Del: non-english -- https://master.php.net/note/delete/83869/non-english
Del: in docs -- https://master.php.net/note/delete/83869/in+docs
Del: other reasons-- https://master.php.net/note/delete/83869
Reject -- https://master.php.net/note/reject/83869
Search -- https://master.php.net/manage/user-notes.php