MSSQL and PHP: "An invalid parameter was passed to sqlsrv_query."

I try to run a very simple MSSQL update statement via PHP, but I get the error message "Invalid parameter passed sqlsrv_query". *

Here's the connection class I'm using, and the most relevant is the query function:

function query($query) {
    $result = sqlsrv_query($query) or die( print_r( sqlsrv_errors(), true));
}

Finally, here is the code that I use to try to execute the statement:

$db = new mssqlClass();
$conn = $db->connect();

$SQL = "UPDATE table SET Title = 'Test' where ID = 1"
$SQL = $db->query($SQL);

If anyone has any suggestions, I would be very grateful, I think this is a problem with the connection class, but I'm not sure. Thank!

(edit) - "where" , ! . , , SQL Server Studio Manager - ..

+3
5

, , , , , Google.

mssql_query, sqlsrv_query , , :

$result = sqlsrv_query($this->connection, $query) or die( print_r( sqlsrv_errors(), true));
+3

, WHERE. :

UPDATE table SET Title = 'Test' WHERE ID = 1

?

0

 UPDATE table SET Title = 'Test', ID = 1

","

0

,

UPDATE table SET Title = 'Test' WHERE ID = 1

UPDATE table SET Title = 'Test', ID = 1
0

:

$result = sqlsrv_query($this->connection, $query) or die( print_r( sqlsrv_errors(), true));

, !

0

All Articles