0
votes

I am trying to call a stored procedure written in MS SQL SERVER 2008 from PHP ODBC through following code, but it does not seem to work:

$statement = odbc_prepare ( $con, "CALL take_snapshot(?)");
if ($statement !== FALSE) {
if (odbc_execute ( $statement, 2010) !== FALSE) {
   return true;
    }
}

In SQL server management studio I simply execute it by writing: exec take_snapshot 2010 in query window and it works fine.

Can anyone guide me with correct syntax of call a procedure from PHP ODBC.

1

1 Answers

0
votes

odbc_execute expects an array for the second parameter. You're passing an integer.

odbc_execute ( resource $result_id [, array $parameters_array ] )

You should use:

 odbc_execute ( $statement, array(2010) )

See the manual