MSSQL PHP cannot delete rows

Viewed 237

First of all sorry for my English. Im trying to delete / insert some rows to a MSSQL Table but i get no error but it just doesnt work. But when I do a SELECT statement it works as well.

$dbhandle = mssql_connect("SERVERNAME", "username", "password") or die("Couldn't connect to SQL Server on $myServer");
$selected = mssql_select_db("myDB", $dbhandle) or die("Couldn't open database $myDB");
mssql_query("DELETE dbo.import");

The server SQL INSTANCE is installed on my local computer and I'm the Administrator of this SQL Server but the Webserver is on another PC. I created the user and I assigned the role db_owner When I try the same query on another SQL Server, it works.

I also tryed:

$dbhandle = mssql_connect("SERVERNAME", "username", "password") or die("Couldn't connect to SQL Server on $myServer");
$selected = mssql_select_db("myDB", $dbhandle) or die("Couldn't open database $myDB");
$result = mssql_query("DELETE dbo.import; SELECT * FROM dbo.import;");
$sqlRows = array();
while($row = mssql_fetch_array($result))
{
    $sqlRows[] = $row;
}
echo sizeof($sqlRows);

and the echo return 0, but when I check from SSMS the records are still there.

 DELETE SCHEMA.TABLE; SELECT * FROM SCHEMA.TABLE;

returns 0 rows. And then I try again

SELECT * FROM dbo.import;

returns 26 rows.

2 Answers
Related