Jump to content

mssql_bind,mssql_execute error


alin19

Recommended Posts

I have this code:

 

it connects to the database, start the statement but i get an error at mssql_execute :

PHP Warning:  mssql_execute(): stored procedure execution failed in /home/alin/NetBeansProjects/MailScanner/index.php on line 30

 

the procedure in the db looks like this:

 

GetUsernames (@resultsCount Int=1);  resultsCount indicates the number of usernames to return. SELECT STMT Returns Username, ServerList

 

 

i can't figure it out, need some help please,

$ParameterOne=1;
$Parameterdoi="";
$ParameterTrei="";

$conn = mssql_connect("***","***","***");
if ($conn===false)

{
}

if (mssql_select_db("***",$conn) === false)
{
}

$proc = mssql_init('GetUsernames',$conn);
mssql_bind($proc,'@resultsCount',$ParameterOne,SQLINT1,true, false, 10);
mssql_bind($proc,'Username',$Parameterdoi,SQLVARCHAR);
mssql_bind($proc,'ServerList',$ParameterTrei,SQLVARCHAR);

if ($result = mssql_execute($proc))
{
if ($row = mssql_fetch_row($result))
{

}

}

Link to comment
https://forums.phpfreaks.com/topic/220145-mssql_bindmssql_execute-error/
Share on other sites

i have fixed it, the problem was not in the code:

 

looks like with mssql you have to define in : /etc/freetds/freetds.conf

 

the server like this:

 

# A typical Microsoft server

[MyServer7]

host = **** ;

port = 1433

tds version = 8.0

 

and then connect like this

 

cu mssql_connect("MyServer7",username,parola);

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.