0

We've been running stored procedures on an MS SQL database though ODBC using PHP. Whenever we run a sp it always returns the same two column names, regardless of the sp run. If the results set has more than two columns, only the first two are returned.

It's like it's got stuck on the results from a previous query. Even when run on their own, in a php file containing only that sp, every sp returns two columns with the same titles as before, regardless of the number of columns or column titles that should be returned. The contents of the columns matches the first two columns we would expect.

Example: looking up contact like in an address book returns the following with the column names of a sp executed this morning, which contained only two columns in the result set.

01234 567890 | John

01234 567890 | Alice

When it should return

01234 567890 | John | Smith | M

01234 567890 | Alice | Chalk | F

with column names 'number' 'fName' 'sName' and 'gender'.

Code is:

$query = "{CALL dbo.storedProc('functionName', $search, 'id')}";
$resultSet = odbc_prepare($connection, $query);
odbc_execute($resultSet, array());
odbc_result_all($resultSet);
4

0 回答 0