I don't want to have an ID number of SQL Server table set to auto increment. So I set this number in my PHP program. The way I do this is that I get the current ID value of the table and then add+1 to it, and insert this number in the table.
EXAMPLE:
$query = "SELECT MAX(ID) FROM T01";
$result=sqlsrv_query($conn, $query);
$IDTable = sqlsrv_fetch_array($result);
$Column1= getPOST('Column1' . $column);
$Column2= getPOST('Column2' . $Column);
$ID1 = $IDTable[0]+1;
$params = array(&$ID1,&$Column1,&$Column2);
# Statement
$sql = "INSERT INTO MyTable ([ID],[Column1],[Column2]) VALUES (?,?); SELECT SCOPE_IDENTITY();";
Now I have a form, and in that form, there can be inserted more than 1 row in SQL table(MyTable). The problem now happens that using the code below it gives all inserted rows same ID. And therefore I get an error saying duplicate ID values.
How can I overcome this?