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
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);

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.