I am trying to access a MSSQL DB on another system.
I am having trouble executed a stored proc and debugging the problem./

I have included the code below.
I can connect to the DB just fine.
I also can run regular queries on the DB and get a result set.
We can also run the stored proc manually with the data in $xmlstring and
that runs fine.

However the mssql_execute is failing.
I am getting the Execute failed die message however I am not getting
anything for mssql_get_last_message

So I have no idea what is happening.
And ideas for solutions or at least to get more debugging information would
be awesome.

I know SQLSRV is a more recent option however we do not have it installed
on the server and will likely not get that to happen so I need to get this

$link = mssql_connect($myServer, $myUser, $myPass)
    or die("Couldn't connect to SQL Server on $myServer");
mssql_select_db($myDB, $link)
    or die("Couldn't select database $myDB");
    die('Error connecting to MSSQL database at '.$myServer);
} else {
    $version = mssql_query('SELECT @@VERSION');
    $row = mssql_fetch_array($version);

    echo $row[0].'<br /><br />';
$storedproc = "Sp_DialerValidLead";
$param = "ValidLeadText";

$stmt = mssql_init('Sp_DialerValidLead', $link)
or die("Unable to initialize");

mssql_bind($stmt, "@".$param, $xmlstring, SQLVARCHAR)
    or die("Unable to bind

$result = mssql_execute($stmt)
    or die ("Execute failed. Message:".mssql_get_last_message());


Blessed Be


"In the Jim Crow South, for example, government failed and indeed refused
to protect blacks from extra-legal violence. Given our history, it's
stunning we fail to question those who would force upon us a total reliance
on the state for defense."
-- Robert J. Cottrol

Reply via email to